<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path;
    String queryString = request.getQueryString() == null ? "" : request.getQueryString().replaceAll("(\\&?lang\\=[a-zA-Z]{2}\\_[a-zA-Z]{2})|(lang\\=[a-zA-Z]{2}\\_[a-zA-Z]{2}\\&?)", "");
    String lang = request.getParameter("lang");
    if (lang != null) {
        session.setAttribute("locale", lang);
    } else if (session.getAttribute("locale") == null) {
        session.setAttribute("locale", request.getLocale().toString());
    }
%>
<!DOCTYPE html>
<html lang="zh">
<c:if test="${'zh_CN'.equals(sessionScope.locale)}">
    <fmt:setLocale value="zh_CN"/>
</c:if>
<c:if test="${sessionScope.locale.indexOf('en') != -1}">
    <fmt:setLocale value="en_US"/>
</c:if>
<fmt:setBundle basename="charts" var="charts"/>
<fmt:bundle basename="charts">
    <head>
        <meta charset="utf-8"/>
            <%-- rem.js --%>
        <script src="<%=basePath%>/js/rem.js"></script>
        <title>医疗设备系统</title>
        <link rel="shortcut icon" href="<%=basePath%>/images/favicon.ico">
        <link href="<%=basePath%>/plugins/charts/css/global.css" rel="stylesheet"/>
        <link rel="stylesheet" href="<%=basePath%>/css/font-awesome.min.css">
        <link rel="stylesheet" href="<%=basePath%>/plugins/iziModal/css/iziModal.min.css">
        <link rel="stylesheet" href="<%=basePath%>/plugins/select2/select2.min.css">
        <link href="<%=basePath%>/plugins/charts/css/style.css" rel="stylesheet"/>
        <link href="<%=basePath%>/plugins/charts/css/select2-my.css" rel="stylesheet"/>
        <link rel="stylesheet" href="<%=basePath%>/plugins/iCheck/all.css">
        <link rel="stylesheet" href="<%=basePath%>/plugins/flavr/flavr.css">
    </head>
    <body>
    <div id="container">
            <%--顶部选项--%>
        <div class="head-container">
            <div class="head">
                <div class="fl global_area">
                    <i class="fa fa-arrow-left fl" onclick="javascript:history.go(-1);"></i>
                    <div class="fl" id="language">
                        <div class="language">
                            <c:choose>
                                <c:when test="${'zh_CN'.equals(sessionScope.locale)}">简体中文</c:when>
                                <c:when test="${sessionScope.locale.indexOf('en') != -1}">English</c:when>
                                <c:otherwise>简体中文</c:otherwise>
                            </c:choose>
                        </div>
                        <ul class="hide">
                            <li><a href="?<%=queryString%>&lang=zh_CN">简体中文</a></li>
                            <li><a href="?<%=queryString%>&lang=en_US">English</a></li>
                        </ul>
                    </div>
                    <ul class="global">
                        <li><a id="btn1"><fmt:message key="share.title.zl"/></a></li>
                        <li><a id="btn2" class="on"><span class="page" page-hospital="department-index"><fmt:message
                                key="share.title.fx"/></span>-<span class="page"
                                                                    page-hospital="type-index"><fmt:message
                                key="share.title.sblx"/></span>-<fmt:message key="brand.overview.sbcj"/></a>
                        </li>
                        <li><a id="btn5"><img src="<%=basePath%>/plugins/charts/images/search.png"></a></li>
                        <li><a id="btn6" onclick="reset()"><img
                                src="<%=basePath%>/plugins/charts/images/reset.png"></a></li>
                        <li><a id="btn7" onclick="logout()" title="<fmt:message key="share.title.tcdl"/>"><img src="<%=basePath%>/plugins/charts/images/logout.png"></a></li>
                    </ul>
                </div>
                <div class="clear"></div>
            </div>
        </div>
            <%--筛选条件--%>
        <jsp:include page="choose.jsp"></jsp:include>

        <div class="content" style="display:flex;flex-direction:column;justify-content:flex-start;">
                <%-- 总量统计 --%>
            <div class="totle">
                    <%-- 设备类型 --%>
                <div class="frame frame1" style="width:24%;">
                    <div class="border">
                        <div class="detail fl">
                            <p class="title"><img src="<%=basePath%>/plugins/charts/images/totle.png"
                                                  width="15"/><em class="spanTitle active" id="title1"><fmt:message
                                    key="brand.overview.sbcjqk"/></em><span
                                    id="yoy0" style="font-size:12px;color:#e68b36;text-decoration:none;"></span></p>
                            <p class="sum"><fmt:message key="share.overview.sbsl"/>：<em id="count1-1"></em> <fmt:message
                                    key="share.unit.tai"/></p>
                            <p class="sum"><fmt:message key="share.overview.tb"/>：<em id="yoy1-1" class="yoy"></em></p>
                        </div>
                        <div class="chart fr chart-text">
                            <p class="sum"><fmt:message key="share.overview.kssl"/>: <em id="count1-2"></em>
                                <fmt:message key="share.unit.ge"/></p>
                            <p class="sum"><fmt:message key="share.overview.sblxsl"/>：<em id="yoy1-2"></em> <fmt:message
                                    key="share.unit.zhong"/></p>
                            <p class="line"></p>
                            <p class="sum"><fmt:message key="index.overview.yyks.sbje"/>:<em id="count1-3"></em>
                                <fmt:message key="share.unit.wanyuan"/></p>
                            <p class="sum"><fmt:message key="share.overview.tb"/>:<em id="count1-4" class="yoy"></em>
                            </p>
                        </div>
                        <div class="clear"></div>
                    </div>
                </div>
                    <%-- >500万设备 --%>
                <div class="frame" style="width:23%;">
                    <div class="border">
                        <div class="detail fl">
                            <p class="title">
                                <em class="spanTitle" id="title2">≥300<fmt:message key="share.unit.wanyuan"/></em>
                            </p>
                            <p class="sum"><fmt:message key="share.overview.sbsl"/>：<em id="count2-1"></em> <fmt:message
                                    key="share.unit.tai"/></p>
                            <p class="sum"><fmt:message key="share.overview.tb"/>：<em id="yoy2-1" class="yoy"></em></p>
                        </div>
                        <div class="chart fr chart-text">
                            <p class="sum"><fmt:message key="share.overview.kssl"/>: <em id="count2-2"></em>
                                <fmt:message key="share.unit.ge"/></p>
                            <p class="sum"><fmt:message key="share.overview.sblxsl"/>：<em id="yoy2-2"></em> <fmt:message
                                    key="share.unit.zhong"/></p>
                            <p class="line"></p>
                            <p class="sum"><fmt:message key="index.overview.yyks.sbje"/>:<em id="count2-3"></em>
                                <fmt:message key="share.unit.wanyuan"/></p>
                            <p class="sum"><fmt:message key="share.overview.tb"/>:<em id="count2-4" class="yoy"></em>
                            </p>
                        </div>
                        <div class="clear"></div>
                    </div>
                </div>
                    <%-- 100-500万设备 --%>
                <div class="frame" style="width:23%;">
                    <div class="border">
                        <div class="detail fl">
                            <p class="title"><em class="spanTitle" id="title3">100-300<fmt:message
                                    key="share.unit.wanyuan"/></em></p>
                            <p class="sum"><fmt:message key="share.overview.sbsl"/>：<em id="count3-1"></em><fmt:message
                                    key="share.unit.tai"/></p>
                            <p class="sum"><fmt:message key="share.overview.tb"/>：<em id="yoy3-1" class="yoy"></em></p>
                        </div>
                        <div class="chart fr chart-text">
                            <p class="sum"><fmt:message key="share.overview.kssl"/>: <em id="count3-2"></em>
                                <fmt:message key="share.unit.ge"/></p>
                            <p class="sum"><fmt:message key="share.overview.sblxsl"/>：<em id="yoy3-2"></em> <fmt:message
                                    key="share.unit.zhong"/></p>
                            <p class="line"></p>
                            <p class="sum"><fmt:message key="index.overview.yyks.sbje"/>:<em id="count3-3"></em>
                                <fmt:message key="share.unit.wanyuan"/></p>
                            <p class="sum"><fmt:message key="share.overview.tb"/>:<em id="count3-4" class="yoy"></em>
                            </p>
                        </div>
                        <div class="clear"></div>
                    </div>
                </div>

                    <%-- 维修情况 --%>
                <div class="frame" style="width:24%;">
                    <div class="border">
                        <div class="detail fl">
                            <p class="title"><em class="spanTitle" id="title4"><fmt:message
                                    key="maintain.overview.wxqk"/></em></p>
                            <p class="sum"><fmt:message key="brand.overview.ycxfl"/>：<em id="count4-1"></em></p>
                            <p class="sum"><fmt:message key="brand.overview.pjwxsj"/>：<em id="yoy4-1"></em> <fmt:message
                                    key="share.unit.fenzhong"/></p>
                        </div>
                        <div class="chart fr chart-text">
                            <p class="sum"><fmt:message key="charts.select.pjwxcs"/>: <em id="count4-2"></em>
                                <fmt:message key="share.unit.ci"/></p>
                            <p class="sum"><fmt:message key="share.overview.tb"/>:<em id="yoy4-2" class="yoy"></em></p>
                            <p class="line"></p>
                            <p class="sum"><fmt:message key="brand.overview.wxje"/>:<em id="count4-3"></em> <fmt:message
                                    key="share.unit.wanyuan"/></p>
                            <p class="sum"><em id="count4-4"></em></p>
                        </div>
                        <div class="clear"></div>
                    </div>
                </div>
            </div>

                <%--图表和排名--%>
            <div class="bottom_bar" style="flex:1;">
                    <%--左边部分--%>
                <div class="list_area fl">
                        <%--图表--%>
                    <div class="border chart-border">
                        <div class="area" style="position:relative;">
                            <p class="title">
                                <span class="fl"><span class="fb spanTitle" id="moredetail"><fmt:message
                                        key="charts.title.sblxfb"/></span></span>
                                <span id="overyear" class="option_overyear"><fmt:message
                                        key="charts.button.lnsj"/></span>
                            </p>
                            <p class="fr title quadrantContainner">
                                <span class="quadrantName"><fmt:message key="charts.button.xx"/>：</span>
                                <span class="quadrant quadrant1">1</span>
                                <span class="quadrant quadrant2">2</span>
                                <span class="quadrant quadrant3">3</span>
                                <span class="quadrant quadrant4">4</span>
                            </p>
                            <div id="swiper">
                                <div class="swiper-container">
                                    <div class="slide home-device">
                                        <div class="chartArea" id="chart" style="height:100%;"></div>

                                        <input id="currentTag" style="display:none;" value="tendency"/>
                                        <div class="pagination pagination1"></div>
                                    </div>
                                </div>
                            </div>
                            <select id="tag">
                                <option value="0" selected="selected"><fmt:message key="charts.select.nxzs"/></option>
                                <option value="1"><fmt:message key="charts.select.pjwxcs"/></option>
                            </select>
                        </div>
                    </div>
                </div>
                    <%--左边结束--%>

                    <%--右侧排名--%>
                <div class="list_data fr">
                    <div class="border">
                        <div class="area">
                            <div class="data_detail">
                                <div id="top5_hospital" class="top5">
                                    <p class="title">
                                        <img src="<%=basePath%>/plugins/charts/images/yljg.png">
                                        <em id="morehospitals" class="spanTitle"><fmt:message
                                                key="share.table.head.yyks"/></em>
                                        <span>TOP5</span>
                                    </p>
                                    <p class="name"><span class="fl data_span_f"><fmt:message
                                            key="share.table.head.yyks"/></span><span
                                            class="fl listpercent data_span_s"><fmt:message
                                            key="index.table.nxzs"/></span><span
                                            class="fr listcontent"><fmt:message key="index.table.sbje(wy)"/></span></p>
                                    <ul class="hospital" id="ul_hospital"></ul>
                                </div>
                                <div id="top5_type" class="top5">
                                    <p class="title">
                                        <img src="<%=basePath%>/plugins/charts/images/sblx.png">
                                        <em id="moretypes" class="spanTitle"><fmt:message
                                                key="share.table.head.sblx"/></em>
                                        <span>TOP5</span></p>
                                    <p class="name">
                                        <span class="fl data_span_f"><fmt:message key="share.table.head.sblx"/></span>
                                        <span class="fl listpercent data_span_s"><fmt:message
                                                key="index.table.nxzs"/></span>
                                        <span class="fr listcontent"><fmt:message key="index.table.sbje(wy)"/></span>
                                    </p>
                                    <ul class="hospital" id="ul_type"></ul>
                                </div>
                                <div id="top5_model" class="top5">
                                    <p class="title">
                                        <img src="<%=basePath%>/plugins/charts/images/sblx.png">
                                        <em id="moremodel" class="spanTitle"><fmt:message
                                                key="share.table.head.sbxh"/></em>
                                        <span>TOP5</span></p>
                                    <p class="name">
                                        <span class="fl data_span_f"><fmt:message key="share.table.head.sbxh"/></span>
                                        <span class="fl listpercent data_span_s"><fmt:message
                                                key="index.table.nxzs"/></span>
                                        <span class="fr listcontent"><fmt:message key="index.table.sbje(wy)"/></span>
                                    </p>
                                    <ul class="hospital" id="ul_model"></ul>
                                </div>

                                <div id="top5_year" class="top5" style="display:none;">
                                    <p class="title">
                                        <em id="moreyears" class="spanTitle" onclick="moreyear()"><fmt:message
                                                key="charts.button.lnsj"/></em>
                                    </p>
                                    <p class="name">
                                        <span class="fl data_span_f"><fmt:message key="share.table.head.nf"/></span>
                                        <span class="fl listpercent data_span_s"><fmt:message
                                                key="index.table.nxzs"/></span>
                                        <span class="fr listcontent"><fmt:message key="index.table.sbje(wy)"/></span>
                                    </p>
                                    <ul class="hospital" id="ul_year"></ul>
                                </div>
                                <div id="top5_device" class="top5">
                                    <p class="title">
                                        <em id="moredevices" class="spanTitle"><fmt:message
                                                key="share.table.head.jtsb"/></em>
                                        <span>TOP5</span></p>
                                    <p class="name">
                                        <span class="fl data_span_f"><fmt:message key="share.table.head.sbmc"/></span>
                                        <span class="fl listpercent data_span_s"><fmt:message
                                                key="index.table.nxzs"/></span>
                                        <span class="fr listcontent"><fmt:message key="index.table.sbje(wy)"/></span>
                                    </p>
                                    <ul class="hospital" id="ul_device"></ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                    <%--右侧结束--%>
            </div>
        </div>
        <div class="baseline"></div>
            <%--详情图表模态框--%>
        <div id="modal" style="display:none">
            <div class="row">
                <div class="col-md-12">
                    <div class="box-body no-padding">
                        <table id="tblSort" class="table table-bordered table-striped table-hover table-responsive">
                            <tbody id="table_data">
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>

        <%-- JS部分 --%>
    <script src="<%=basePath%>/plugins/jQuery/jquery-2.2.3.min.js"></script>
    <script src="<%=basePath%>/plugins/jQuery/jquery.cookie.js"></script>
    <script src="<%=basePath%>/plugins/fastclick/fastclick_1.0.6.min.js"></script>
    <script src="<%=basePath%>/plugins/flavr/flavr.min.js"></script>
    <script src="<%=basePath%>/plugins/charts/js/echarts.min.js"></script>
    <!-- 引入 macarons 主题 -->
    <script src="<%=basePath%>/echarts/customed.js"></script>
    <script src="<%=basePath%>/plugins/select2/select2.full.min.js"></script>
    <script src="<%=basePath%>/plugins/select2/i18n/zh-CN.js"></script>
    <script src="<%=basePath%>/plugins/iziModal/js/iziModal.min.js"></script>
    <script src="<%=basePath%>/plugins/iCheck/icheck.min.js"></script>
    <script src="<%=basePath%>/plugins/charts/js/plugins.js"></script>
    <script src="<%=basePath%>/plugins/charts/js/tableHeadFixer.js"></script>
    <script>
        /*--------- 全局变量 ---------*/
        var CONST = 1000000;
        var basePath = '<%=basePath%>';
        var title = 0;
        /*--------- 全局变量 ---------*/

        /* 页面初始化 */
        $(function () {
            loading(function () {
                addChooseRadioEvent('hospital');
                resizeWindow();
                initChart();  // 初始化图表
                ChooseBox.siblingsClick();
                querySearch("hospital", '');
                querySearch("risk", '');
                querySearch("type", '');
                querySearch("brand", '');
                querySearch("year", '');
                getParams();
                appendTime();
                clickChange($('.detail .title em'));
                clickToggle($('.quadrant'));
                $("#btn5").click(function () {
                    ChooseBox.toggle();
                });

                $('#tag').select2();
                $('#tag').on('change', function () {
                    title = $(this).val();
                    queryChartsData();
                    queryTypeTop5Data();
                    queryModelTop5Data();
                    queryDeviceTop5Data();
                });
            });
        });

        // 初始化图表并添加图表点击事件
        function initChart() {
            chart = echarts.init(document.getElementById('chart'), 'customed');  // 初始化echarts实例
            chart.on("click", click);
        }

        // #title1
        $('#title1').click(function () {
            $('#priceStart').val('');
            $('#priceEnd').val('');
            loading(function () {
                queryChartsData();
                queryTypeTop5Data();
                queryModelTop5Data();
                queryDeviceTop5Data();
            });
        });
        // #title2
        $('#title2').click(function () {
            $('#priceStart').val(300);
            $('#priceEnd').val('');
            loading(function () {
                queryChartsData();
                queryTypeTop5Data();
                queryModelTop5Data();
                queryDeviceTop5Data();
            });
        });
        // #title3
        $('#title3').click(function () {
            $('#priceStart').val(100);
            $('#priceEnd').val(300);
            loading(function () {
                queryChartsData();
                queryTypeTop5Data();
                queryModelTop5Data();
                queryDeviceTop5Data();
            });
        });

        var queryStatus = {
            arr: ['hospital', 'model', 'type', 'assets'],
            getStatus: function () {
                for (var i = 0; i < this.arr.length; i++) {
                    if (!this[this.arr[i]]) return false;
                }
                return true;
            },
            resetStatus: function () {
                for (var i = 0; i < this.arr.length; i++) {
                    this[this.arr[i]] = false;
                }
            }
        };
        function click(param) {
            if (typeof param.seriesIndex === 'undefined') {
                return;
            }
            if (param.componentType === 'markLine') {
                return;
            }
            loading();
            if (param.type === 'click') {
                var index = param.dataIndex;
                if ($('#overyear').hasClass('active')) {
                    loading(true);
                    return;
                    $('.select_year').val(idsB[index]).trigger('change');
                    $('#overyear').removeClass('active');
                    getParams();
                } else {
                    var tab;
                    if (($('.select_type').val() ? $('.select_type').val() : []).join(',') == [idsType[index]].join(',')) {
                        $('.select_type').val('').trigger('change');
                        typeId = '';
                        tab = false;
                        index = 0;
                    } else {
                        $('.select_type').val([ids[index]]).trigger('change');
                        typeId = [idsType[index]];
                        tab = true;
                    }
                    setUlType('desc', index, tab);
                    queryStatus.type = true;
                    queryChartsData();
                    queryModelTop5Data();
                    queryDeviceTop5Data();
                }
            }
        }


        //查询筛选条件
        var typeIdArr;

        function querySearch(tag, tagId) {
            var url = "<%=basePath%>/hospital/search/" + (tag == 'hospital' ? 'department' : tag);
            $.ajax({
                type: "POST",
                data: {
                  hospitalId: hspId},
                url: url,
                async: false,
                dataType: "json",
                success: function (data) {
                    if (data.ret == 1) {
                        data.data = data.data || {list: []};
                        var searchData = data.data;
                        setSearch(tag, searchData);
                        $('.select_' + tag).select2({
                            placeholder: '<fmt:message key="share.sift.qxz"/>',
                            allowClear: true
                        });
                        ChooseBox.setSearchFromCookie(tag);
                        if (tag == 'type') {
                            searchDataGlobal = searchData;
                            $('.select_type').on('select2:select', function (param) {
                                typeIdArr = $('.select_type').val();
                                var id = param.params.data.id;
                                if (id < 2016102346) {
                                    for (var i = 0; i < searchDataGlobal[id].length; i++) {
                                        typeIdArr.push(searchDataGlobal[id][i].id)
                                    }
                                }
                                $('.select_type').val(typeIdArr).trigger('change');
                            });
                            $('.select_type').on('select2:unselect', function (param) {
                                typeIdArr = $('.select_type').val();
                                var id = param.params.data.id;
                                typeIdArr.removeByValue(id);
                                if (id < 2016102346) {
                                    for (var i = 0; i < searchDataGlobal[id].length; i++) {
                                        typeIdArr.removeByValue(searchDataGlobal[id][i].id)
                                    }
                                }
                                $('.select_type').val(typeIdArr).trigger('change');
                            });
                        }
                        if(tag == 'type' && window.location.search.split('=')[1]){
                            typeId = GetQueryString('typeId') ? [GetQueryString('typeId')] : '';
                            $('.select_type').val(typeId).trigger('change');
                        }
                        if (tag == 'brand') {
                            if (window.location.search.split('=')[1]) {
                                brandId = GetQueryString('brandId') ? [GetQueryString('brandId')] : '';
                                $('.select_brand').val(brandId).trigger('change');
                            }
                        }
                    } else {
                        if (data.msg == '该用户不存在') {
                            location.href = '<%=basePath%>';
                        } else {
                            flavrShowByTime(data.msg, null, "danger", false);
                        }
                    }
                },
                failure: function () {
                    flavrShowByTime(data.msg, null, "danger", false);
                }
            })
        }

        /* 设置搜索框搜索条件 */
        function setSearch(tag, data) {
            var first, second, id, str, str1;
            if (tag === "type") {
                str = '';
                first = data.first;
                for (var i = 0; i < first.length; i++) {
                    //一级设备
                    if ('${sessionScope.locale}'.indexOf('en') != -1) {
                        str += '<optgroup label="' + (first[i].enName || "") + '">' +
                            (function () {
                                str1 = '';
                                id = first[i].id;
                                if (data[id]) {
                                    //一级设备
                                    str1 = '<option value="' + first[i].id + '">' + (first[i].enName || "") + '</option>';
                                    second = data[id];
                                    for (var j = 0; j < second.length; j++) {
                                        //二级设备
                                        str1 += '<option value="' + second[j].id + '">' + (second[j].enName || "") + '</option>';
                                    }
                                } else {
                                    str1 = '<option value="' + first[i].id + '">' + (first[i].enName || "") + '</option>';
                                }
                                return str1;
                            })() +
                            '</optgroup>';
                    } else {
                        str += '<optgroup label="' + (first[i].name || "") + '">' +
                            (function () {
                                str1 = '';
                                id = first[i].id;
                                if (data[id]) {
                                    //一级设备
                                    str1 = '<option value="' + first[i].id + '">' + (first[i].name || "") + '</option>';
                                    second = data[id];
                                    for (var j = 0; j < second.length; j++) {
                                        //二级设备
                                        str1 += '<option value="' + second[j].id + '">' + (second[j].name || "") + '</option>';
                                    }
                                } else {
                                    str1 = '<option value="' + first[i].id + '">' + (first[i].name || "") + '</option>';
                                }
                                return str1;
                            })() +
                            '</optgroup>';
                    }
                }
                $(".select_type").append(str);
            } else {
                data = data.list;
                if (tag == 'department') {
                    if ('${sessionScope.locale}'.indexOf('en') != -1) {
                        for (var i = 0; i < data.length; i++) {
                            $(".select_" + 'hospital').append('<option value="' + data[i].id + '">' + (data[i].enName || "") + '</option>');
                        }
                    } else {
                        for (var i = 0; i < data.length; i++) {
                            $(".select_" + 'hospital').append('<option value="' + data[i].id + '">' + (data[i].name || "") + '</option>');
                        }
                    }
                } else {
                    if ('${sessionScope.locale}'.indexOf('en') != -1) {
                        for (var i = 0; i < data.length; i++) {
                            $(".select_" + tag).append('<option value="' + data[i].id + '">' + (data[i].enName || "") + '</option>');
                        }
                    } else {
                        for (var i = 0; i < data.length; i++) {
                            $(".select_" + tag).append('<option value="' + data[i].id + '">' + (data[i].name || "") + '</option>');
                        }
                    }
                }
            }

        }

        //全市详情
        function queryAllAssets() {
            $.ajax({
                type: "POST",
                url: "<%=basePath%>/charts/hospital/type-brand/overview",
                async: true,
                data: {
                  hospitalId: hspId,
                    departmentId: hospitalId ? JSON.stringify(hospitalId) : '',
                    riskId: riskId ? JSON.stringify(riskId) : '',
                    typeId: typeId ? JSON.stringify(typeId) : '',
                    brandId: brandId ? JSON.stringify(brandId) : '',
                    year: year ? JSON.stringify(year) : '',
                    monthId: monthId ? JSON.stringify(monthId) : '',
                    enableYearStart: enableYearStart,
                    enableYearEnd: enableYearEnd,
                    priceStart: priceStart,
                    priceEnd: priceEnd,
                    ageLimitStart: ageLimitStart,
                    ageLimitEnd: ageLimitEnd
                },
                dataType: "json",
                success: function (data) {
                    if (data.ret == 1) {
                        data.data = data.data || {list: []};
                        data = data.data;
                        assets = data;
                        // 设备数量 及 去年同比
                        $('#count1-1').html(data.allAssets.curCounts || 0);
                        $('#yoy1-1').html(parseFloat(data.allAssets.deviceCountsYoy || 0).toFixed(2) + '%');
                        // 医院数量
                        $('#count1-2').html(data.allAssets.hospitalCounts || 0);
                        $('#yoy1-2').html(data.allAssets.typeCounts || 0);
                        // 设备金额 及 去年同比
                        $('#count1-3').html(parseFloat((data.allAssets.curPrice / CONST) || 0).toFixed(2));
                        $('#count1-4').html(parseFloat(data.allAssets.devicePriceYoy || 0).toFixed(2) + '%');

                        // 设备数量 及 去年同比
                        $('#count2-1').html(data.amountList[0].curCounts || 0);
                        $('#yoy2-1').html(parseFloat(data.amountList[0].deviceCountsYoy || 0).toFixed(2) + '%');
                        // 医院数量
                        $('#count2-2').html(data.amountList[0].hospitalCounts || 0);
                        $('#yoy2-2').html(data.amountList[0].typeCounts || 0);
                        // 设备金额 及 去年同比
                        $('#count2-3').html(parseFloat((data.amountList[0].curPrice / CONST) || 0).toFixed(2));
                        $('#count2-4').html(parseFloat(data.amountList[0].devicePriceYoy || 0).toFixed(2) + '%');

                        // 设备数量 及 去年同比
                        $('#count3-1').html(data.amountList[1].curCounts || 0);
                        $('#yoy3-1').html(parseFloat(data.amountList[1].deviceCountsYoy || 0).toFixed(2) + '%');
                        // 医院数量
                        $('#count3-2').html(data.amountList[1].hospitalCounts || 0);
                        $('#yoy3-2').html(data.amountList[1].typeCounts || 0);
                        // 设备金额 及 去年同比
                        $('#count3-3').html(parseFloat((data.amountList[1].curPrice / CONST) || 0).toFixed(2));
                        $('#count3-4').html(parseFloat(data.amountList[1].devicePriceYoy || 0).toFixed(2) + '%');

                        // 一次维修率 及 维修时间
                        $('#count4-1').html(parseFloat(data.maintainInfo.curOnceRepairRate || 0).toFixed(2) + ' %');
                        $('#yoy4-1').html(data.maintainInfo.curAvgRepairUsedMin || 0);
                        // 维修次数
                        $('#count4-2').html(data.maintainInfo.curToRepairCounts || 0);
                        $('#yoy4-2').html(parseFloat(data.maintainInfo.toRepairCountsYoy || 0).toFixed(2) + '%');
                        // 维修金额 及 去年同比
                        $('#count4-3').html(parseFloat((data.maintainInfo.curEstimateTotalCost / CONST) || 0).toFixed(2));

                        addArrowYoy('.totle');
                    } else {
                        flavrShowByTime(data.msg, null, "danger", false);
                    }
                },
                failure: function () {
                    flavrShowByTime(data.msg, null, "danger", false);
                }
            });
        }

        // 点击TOP5排序
        var sort_status = 0;
        $('.listpercent ').click(function () {
            sort_status++;
            if (sort_status % 2 == 0) {
                sortord = 'desc';
                $(this).find('i').removeClass('fa-arrow-down').addClass('fa-arrow-up');
                $(this).next('span.listcontent').find('i').removeClass('fa-arrow-down').addClass('fa-arrow-up');
            } else {
                sortord = 'asc';
                $(this).find('i').removeClass('fa-arrow-up').addClass('fa-arrow-down');
                $(this).next('span.listcontent').find('i').removeClass('fa-arrow-up').addClass('fa-arrow-down');
            }
            var id = $(this).parent('p.name').next('ul.hospital').attr('id');
            if (id == 'ul_hospital') {
                setUlHospital(sortord);
            } else if (id == 'ul_type') {
                setUlType(sortord);
            } else if (id == 'ul_amount') {
                setUlAmount(sortord);
            } else if (id == 'ul_agelimit') {
                setUlAgelimit(sortord);
            } else if (id == 'ul_brand') {
                setUlBrand(sortord);
            }
        });
        $('.listcontent ').click(function () {
            sort_status++;
            if (sort_status % 2 == 0) {
                sortord = 'desc';
                $(this).find('i').removeClass('fa-arrow-down').addClass('fa-arrow-up');
                $(this).prev('span.listpercent').find('i').removeClass('fa-arrow-down').addClass('fa-arrow-up');
            } else {
                sortord = 'asc';
                $(this).find('i').removeClass('fa-arrow-up').addClass('fa-arrow-down');
                $(this).prev('span.listpercent').find('i').removeClass('fa-arrow-up').addClass('fa-arrow-down');
            }
            var id = $(this).parent('p.name').next('ul.hospital').attr('id');
            if (id == 'ul_hospital') {
                setUlHospital(sortord);
            } else if (id == 'ul_type') {
                setUlType(sortord);
            } else if (id == 'ul_amount') {
                setUlAmount(sortord);
            } else if (id == 'ul_agelimit') {
                setUlAgelimit(sortord);
            } else if (id == 'ul_brand') {
                setUlBrand(sortord);
            }
        });

        //医院top5
        function setUlHospital(sortord, index, tab) {
            index = index ? index : 0;
            var len = xAxis.length;
            var x = 0,
                y = 0;
            if (index < 3) {
                x = 0;
            } else if (len - index < 3) {
                x = (len - 5) > 0 ? (len - 5) : 0;
            } else {
                x = index - 2;
            }
            y = len > 5 ? x + 5 : len;
            var percent, count;
            $("#ul_hospital").html('');
            for (var i = x; i < y; i++) {
                if (title == 0) {
                    percent = parseFloat(seriesAgeLimitMeasure[i] || 0).toFixed(2);
                    count = parseFloat(seriesPrice[i]).toFixed(2);
                } else if (title == 1) {
                    percent = (curFaultCounts[i] || 0);
                    count = (curToRepairCounts[i] || 0);
                }
                $("#ul_hospital").append(
                    '<li><a title="' + (i + 1) + ' ' + fullName[i] + '"><span class="fl data_span_f">' + xAxis[i] + '</span><em class="fl data_span_s">'
                    + percent + '</em><em class="fr">'
                    + count + '</em></a></li>');
            }
        }

        //设置与图表对应的表的内容
        function setUlType(sortord, index, tab) {
            index = index ? index : 0;
            var len = xAxisType.length;
            var x = 0,
                y = 0;
            if (index < 3) {
                x = 0;
            } else if (len - index < 3) {
                x = (len - 5) > 0 ? (len - 5) : 0;
            } else {
                x = index - 2;
            }
            y = len > 5 ? x + 5 : len;
            var percent, count;
            $("#ul_type").html('');
            for (var i = x; i < y; i++) {
                if (title == 0) {
                    percent = parseFloat(seriesAgeLimitMeasureType[i] || 0).toFixed(2);
                    count = parseFloat(seriesPriceType[i]).toFixed(2);
                } else if (title == 1) {
                    percent = (curFaultCountsType[i] || 0);
                    count = (curToRepairCountsType[i] || 0);
                }
                $("#ul_type").append(
                    '<li><a title="' + (i + 1) + ' ' + fullNameType[i] + '"' + ((tab && i == index) ? 'class="active"' : '') + '><span class="fl data_span_f">' + xAxisType[i] + '</span><em class="fl data_span_s">'
                    + percent + '</em><em class="fr">'
                    + count + '</em></a></li>'
                );
            }
        }

        //设备厂家top5
        function setUlModel(sortord, index) {
            index = index ? index : 0;
            var len = xAxisModel.length;
            var x = 0,
                y = 0;
            if (index < 3) {
                x = 0;
            } else if (len - index < 3) {
                x = (len - 5) > 0 ? (len - 5) : 0;
            } else {
                x = index - 2;
            }
            y = len > 5 ? x + 5 : len;
            var percent, count;
            $("#ul_model").html('');
            for (var i = x; i < y; i++) {
                if (title == 0) {
                    percent = parseFloat(seriesAgeLimitMeasureModel[i] || 0).toFixed(2);
                    count = parseFloat(seriesPriceModel[i]).toFixed(2);
                } else if (title == 1) {
                    percent = (curFaultCountsModel[i] || 0);
                    count = (curToRepairCountsModel[i] || 0);
                }
                $("#ul_model").append(
                    '<li><a title="' + (i + 1) + ' ' + fullNameModel[i] + '"><span class="fl data_span_f">' + xAxisModel[i] + '</span><em class="fl data_span_s">'
                    + percent + '</em><em class="fr">'
                    + count + '</em></a></li>');
            }
        }

        function setUlDevice(sortord, index) {
            index = index ? index : 0;
            var len = xAxisDevice.length;
            var x = 0,
                y = 0;
            if (index < 3) {
                x = 0;
            } else if (len - index < 3) {
                x = (len - 5) > 0 ? (len - 5) : 0;
            } else {
                x = index - 2;
            }
            y = len > 5 ? x + 5 : len;
            var percent, count;
            $("#ul_device").html('');
            for (var i = x; i < y; i++) {
                if (title == 0) {
                    percent = parseFloat(ageLimitMeasureDevice[i] || 0).toFixed(2);
                    count = parseFloat(priceDevice[i]).toFixed(2);
                } else if (title == 1) {
                    percent = (curFaultCountsDevice[i] || 0);
                    count = (curToRepairCountsDevice[i] || 0);
                }
                $("#ul_device").append(
                    '<li><a title="' + (i + 1) + ' ' + fullNameDevice[i] + '"><span class="fl data_span_f">' + xAxisDevice[i] + '</span><em class="fl data_span_s">'
                    + percent + '</em><em class="fr">'
                    + count + '</em></a></li>');
            }
        }

        //获取筛选条件参数
        function getParams() {
            loading(function () {
                $('.quadrantContainner').show();
                $('.quadrant').removeClass('active');
                showYearTop5();
                $('.option_overyear').html('<fmt:message key="charts.button.lnsj"/>').removeClass('active');
                $('#moredetail').html('<fmt:message key="charts.title.sblxfb"/>').off().on('click', moretypes);
                $('#tag').next().show();

                hospitalId = $('.select_hospital').val() ? $('.select_hospital').val() : '';
                riskId = $('.select_risk').val() ? $('.select_risk').val() : '';
                typeId = $('.select_type').val() ? $('.select_type').val() : '';
                brandId = $('.select_brand').val() ? $('.select_brand').val() : '';
                year = $('.select_year').val() ? $('.select_year').val() : '';
                monthId = $('.select_month').val() ? $('.select_month').val() : '';
                enableYearStart = $('#enableYearStart').val() ? $('#enableYearStart').val() : '';
                enableYearEnd = $('#enableYearEnd').val() ? $('#enableYearEnd').val() : '';
                priceStart = $('#priceStart').val() ? $('#priceStart').val() * CONST : '';
                priceEnd = $('#priceEnd').val() ? $('#priceEnd').val() * CONST : '';
                ageLimitStart = $('#ageLimitStart').val() ? $('#ageLimitStart').val() : '';
                ageLimitEnd = $('#ageLimitEnd').val() ? $('#ageLimitEnd').val() : '';

                var oldParams = JSON.parse($.cookie('chooseValue') || '{}');
                $.cookie('chooseValue', JSON.stringify({
                    hospitalId: hospitalId,
                    riskId: riskId,
                    typeId: GetQueryString('typeId') ? oldParams.typeId : typeId,
                    brandId: GetQueryString('brandId') ? oldParams.brandId : brandId,
                    year: year,
                    monthId: monthId,
                    enableYearStart: enableYearStart,
                    enableYearEnd: enableYearEnd,
                    priceStart: priceStart,
                    priceEnd: priceEnd,
                    ageLimitStart: ageLimitStart,
                    ageLimitEnd: ageLimitEnd
                }), {path: '/'});

                queryAllAssets();
                queryChartsData();
                queryTypeTop5Data();
                queryModelTop5Data();
                queryDeviceTop5Data();
            });
        }

        // 获取图表数据(医院)
        function queryChartsData(tableId) {
            ids = [];
            xAxis = [];
            seriesPrice = [];   //设备金额
            seriesCount = [];   //设备数量
            seriesPriceYoy = [];    //金额同比
            seriesCountYoy = [];    //数量同比
            seriesHospitalCount = [];   //医院数量
            seriesTypeCount = [];   //设备类型数量
            seriesDepreciationPrice = [];   //折旧金额
            seriesAgeLimitMeasure = [];     //年限指数
            seriesDepreciationRatio = [];   //折旧率
            seriesDepreciationYoy = [];     //折旧同比
            fullName = [];

            /* 平均维修次数 */
            curBigRepairCounts = [];
            curMiddleRepairCounts = [];
            curSmallRepairCounts = [];
            curAvgRepairUsedMin = [];
            curAvgResponseMin = [];
            curFaultCounts = [];
            curToRepairCounts = [];
            curIntactRatio = [];
            curOnceRepairRate = [];
            curUpkeepRate = [];

            var url = '';
            if (title == 0) {
                url = '<%=basePath%>/charts/hospital/type-brand/department';
            } else {
                url = '<%=basePath%>/charts/hospital/type-maintain/department';
            }
            $.ajax({
                type: "POST",
                url: url,
                data: {
                  hospitalId: hspId,
                    departmentId: hospitalId ? JSON.stringify(hospitalId) : '',
                    riskId: riskId ? JSON.stringify(riskId) : '',
                    typeId: typeId ? JSON.stringify(typeId) : '',
                    brandId: brandId ? JSON.stringify(brandId) : '',
                    year: year ? JSON.stringify(year) : '',
                    monthId: monthId ? JSON.stringify(monthId) : '',
                    enableYearStart: enableYearStart,
                    enableYearEnd: enableYearEnd,
                    priceStart: priceStart,
                    priceEnd: priceEnd,
                    ageLimitStart: ageLimitStart,
                    ageLimitEnd: ageLimitEnd
                },
                dataType: "json",
                success: function (data) {
                    if (data.ret == 1) {
                        data.data = data.data || {list: []};
                        if (data.data.list) {
                            for (var i = 0; i < data.data.list.length; i++) {
                                ids.push(data.data.list[i].id || '');
                                if ('${sessionScope.locale}'.indexOf('en') != -1) {
                                    xAxis.push(data.data.list[i].enName || '');
                                    fullName.push(data.data.list[i].fullEnName || '');
                                } else {
                                    xAxis.push(data.data.list[i].name || '');
                                    fullName.push(data.data.list[i].fullName || '');
                                }
                                if (title == 0) {
                                    seriesPrice.push(parseFloat((data.data.list[i].curPrice / CONST) || 0).toFixed(2));
                                    seriesCount.push(data.data.list[i].curCounts || 0);
                                    seriesPriceYoy.push(parseFloat(data.data.list[i].devicePriceYoy || 0).toFixed(2));
                                    seriesCountYoy.push(parseFloat(data.data.list[i].deviceCountsYoy || 0).toFixed(2));
                                    seriesHospitalCount.push(data.data.list[i].hospitalCounts || 0);
                                    seriesTypeCount.push(data.data.list[i].typeCounts || 0);
                                    seriesDepreciationPrice.push(parseFloat((data.data.list[i].curDepreciationPrice / CONST) || 0).toFixed(2));
                                    seriesAgeLimitMeasure.push(parseFloat(data.data.list[i].curAgeLimitMeasure || 0).toFixed(2));
                                    seriesDepreciationRatio.push(parseFloat(data.data.list[i].depreciationRatio || 0).toFixed(2));
                                    seriesDepreciationYoy.push(parseFloat(data.data.list[i].depreciationYoy || 0).toFixed(2));
                                } else if (title == 1) {
                                    curBigRepairCounts.push(data.data.list[i].curBigRepairCounts || 0);
                                    curMiddleRepairCounts.push(data.data.list[i].curMiddleRepairCounts || 0);
                                    curSmallRepairCounts.push(data.data.list[i].curSmallRepairCounts || 0);
                                    curAvgRepairUsedMin.push(data.data.list[i].curAvgRepairUsedMin || 0);
                                    curAvgResponseMin.push(data.data.list[i].curAvgResponseMin || 0);
                                    curFaultCounts.push(data.data.list[i].curFaultCounts || 0);
                                    curToRepairCounts.push(data.data.list[i].curToRepairCounts || 0);
                                    curIntactRatio.push(parseFloat(data.data.list[i].curIntactRatio || 0).toFixed(2));
                                    curOnceRepairRate.push(parseFloat(data.data.list[i].curOnceRepairRate || 0).toFixed(2));
                                    curUpkeepRate.push(parseFloat(data.data.list[i].curUpkeepRate || 0).toFixed(2));
                                }
                            }
                            if (title == 0) {
                                $('.listcontent').html('<fmt:message key="index.table.sbje(wy)"/>');
                                $('.listpercent').html('<fmt:message key="maintain.table.nxzs"/>');
                                sort('desc', seriesPrice, ids, xAxis, seriesCount, seriesPriceYoy, seriesCountYoy, seriesHospitalCount, seriesTypeCount, seriesDepreciationPrice, seriesAgeLimitMeasure, seriesDepreciationRatio, seriesDepreciationYoy, fullName);
                            } else if (title == 1) {
                                $('.listcontent').html('<fmt:message key="maintian.assets.wxcs"/>');
                                $('.listpercent').html('<fmt:message key="maintain.table.blsj(c)"/>');
                                sort('desc', curToRepairCounts, ids, xAxis, fullName, curBigRepairCounts, curMiddleRepairCounts, curSmallRepairCounts, curAvgRepairUsedMin, curAvgResponseMin, curFaultCounts, curIntactRatio, curOnceRepairRate, curUpkeepRate);
                            }
                        }
                        setUlHospital('desc', 0);
                        if ((!$('#modal').is(':hidden')) && ($('#modal').attr('modal') == 'hospital')) morehospitals();

                        queryStatus.hospital = true;
                        if (queryStatus.getStatus()) {
                            loading(true);
                            queryStatus.resetStatus();
                        }
                    } else {
                        flavrShowByTime(data.msg, null, "danger", false);
                    }
                },
                failure: function () {
                    flavrShowByTime(data.msg, null, "danger", false);
                }
            })
        }

        // 获取图表数据(设备类型)
        function queryTypeTop5Data(tableId) {
            idsType = [];
            xAxisType = [];
            seriesPriceType = [];   //设备金额
            seriesCountType = [];   //设备数量
            seriesPriceYoyType = [];    //金额同比
            seriesCountYoyType = [];    //数量同比
            seriesHospitalCountType = [];   //医院数量
            seriesTypeCountType = [];   //设备类型数量
            seriesDepreciationPriceType = [];   //折旧金额
            seriesAgeLimitMeasureType = [];     //年限指数
            seriesDepreciationRatioType = [];   //折旧率
            seriesDepreciationYoyType = [];     //折旧同比
            seriesType = [];    //气泡图数据
            fullNameType = [];

            /* 平均维修次数 */
            curBigRepairCountsType = [];
            curMiddleRepairCountsType = [];
            curSmallRepairCountsType = [];
            curAvgRepairUsedMinType = [];
            curAvgResponseMinType = [];
            curFaultCountsType = [];
            curToRepairCountsType = [];
            curIntactRatioType = [];
            curOnceRepairRateType = [];
            curUpkeepRateType = [];

            typeJson = [];
            var url = '';
            if (title == 0) {
                url = '<%=basePath%>/charts/hospital/type-brand/type';
            } else {
                url = '<%=basePath%>/charts/hospital/type-maintain/type';
            }
            $.ajax({
                type: "POST",
                url: url,
                data: {
                  hospitalId: hspId,
                    departmentId: hospitalId ? JSON.stringify(hospitalId) : '',
                    riskId: riskId ? JSON.stringify(riskId) : '',
                    typeId: typeId ? JSON.stringify(typeId) : '',
                    brandId: brandId ? JSON.stringify(brandId) : '',
                    year: year ? JSON.stringify(year) : '',
                    monthId: monthId ? JSON.stringify(monthId) : '',
                    enableYearStart: enableYearStart,
                    enableYearEnd: enableYearEnd,
                    priceStart: priceStart,
                    priceEnd: priceEnd,
                    ageLimitStart: ageLimitStart,
                    ageLimitEnd: ageLimitEnd
                },
                dataType: "json",
                success: function (data) {
                    if (data.ret == 1) {
                        data.data = data.data || {list: []};
                        typeJson = data.data.list;
                        if (data.data.list) {
                            for (var i = 0; i < typeJson.length; i++) {
                                if (lang === 'en') {
                                    typeJson[i].name = typeJson[i].enName;
                                }
                                for (var j = 0; j < typeJson[i].list.length; j++) {
                                    if ('${sessionScope.locale}'.indexOf('en') != -1) {
                                        xAxisType.push(typeJson[i].list[j].enName || '');
                                        fullNameType.push(typeJson[i].list[j].fullEnName || '');
                                        typeJson[i].list[j].name = typeJson[i].list[j].enName;
                                    } else {
                                        xAxisType.push(typeJson[i].list[j].name || '');
                                        fullNameType.push(typeJson[i].list[j].fullName || '');
                                    }
                                    idsType.push(typeJson[i].list[j].id || '');

                                    if (title == 0) {
                                        seriesPriceType.push(parseFloat((typeJson[i].list[j].curPrice / CONST) || 0).toFixed(2));
                                        seriesCountType.push(typeJson[i].list[j].curCounts || 0);
                                        seriesPriceYoyType.push(parseFloat(typeJson[i].list[j].devicePriceYoy || 0).toFixed(2));
                                        seriesCountYoyType.push(parseFloat(typeJson[i].list[j].deviceCountsYoy || 0).toFixed(2));
                                        seriesHospitalCountType.push(typeJson[i].list[j].hospitalCounts || 0);
                                        seriesTypeCountType.push(typeJson[i].list[j].typeCounts || 0);
                                        seriesDepreciationPriceType.push(parseFloat((typeJson[i].list[j].curDepreciationPrice / CONST) || 0).toFixed(2));
                                        seriesAgeLimitMeasureType.push(parseFloat(typeJson[i].list[j].curAgeLimitMeasure || 0).toFixed(2));
                                        seriesDepreciationRatioType.push(parseFloat(typeJson[i].list[j].depreciationRatio || 0).toFixed(2));
                                        seriesDepreciationYoyType.push(parseFloat(typeJson[i].list[j].depreciationYoy || 0).toFixed(2));
                                        seriesType.push([parseFloat((typeJson[i].list[j].curPrice / CONST) || 0).toFixed(2), parseFloat(typeJson[i].list[j].curAgeLimitMeasure || 0).toFixed(2), 50, typeJson[i].list[j].name]);
                                    } else if (title == 1) {
                                        curBigRepairCountsType.push(typeJson[i].list[j].curBigRepairCounts || 0);
                                        curMiddleRepairCountsType.push(typeJson[i].list[j].curMiddleRepairCounts || 0);
                                        curSmallRepairCountsType.push(typeJson[i].list[j].curSmallRepairCounts || 0);
                                        curAvgRepairUsedMinType.push(typeJson[i].list[j].curAvgRepairUsedMin || 0);
                                        curAvgResponseMinType.push(typeJson[i].list[j].curAvgResponseMin || 0);
                                        curFaultCountsType.push(typeJson[i].list[j].curFaultCounts || 0);
                                        curToRepairCountsType.push(typeJson[i].list[j].curToRepairCounts || 0);
                                        curIntactRatioType.push(parseFloat(typeJson[i].list[j].curIntactRatio || 0).toFixed(2));
                                        curOnceRepairRateType.push(parseFloat(typeJson[i].list[j].curOnceRepairRate || 0).toFixed(2));
                                        curUpkeepRateType.push(parseFloat(typeJson[i].list[j].curUpkeepRate || 0).toFixed(2));
                                    }
                                }
                            }
                            if (title == 0) {
                                avgDevicePrice = parseFloat((data.data.avgPrice || 0) / CONST).toFixed(2);
                                avgEstimateTotalCost = 1;
                                sort('desc', seriesPriceType, idsType, xAxisType, seriesCountType, seriesPriceYoyType, seriesCountYoyType, seriesHospitalCountType, seriesTypeCountType, seriesDepreciationPriceType, seriesAgeLimitMeasureType, seriesDepreciationRatioType, seriesDepreciationYoyType, fullNameType, seriesType);
                            } else if (title == 1) {
                                sort('desc', curToRepairCountsType, idsType, xAxisType, fullNameType, curBigRepairCountsType, curMiddleRepairCountsType, curSmallRepairCountsType, curAvgRepairUsedMinType, curAvgResponseMinType, curFaultCountsType, curIntactRatioType, curOnceRepairRateType, curUpkeepRateType);
                            }
                        }
                    } else {
                        flavrShowByTime(data.msg, null, "danger", false);
                    }
                    setChatsData(title);
                    setUlType('desc', 0);
                    if ((!$('#modal').is(':hidden')) && ($('#modal').attr('modal') == 'type')) moretypes();

                    queryStatus.type = true;
                    if (queryStatus.getStatus()) {
                        loading(true);
                        queryStatus.resetStatus();
                    }
                },
                failure: function () {
                    flavrShowByTime(data.msg, null, "danger", false);
                }
            })
        }

        /*
        * tag   select的值　0-年限指数  1-平均维修次数
        * 设置图表数据
        * */
        function setChatsData(tag) {
            var series = [];
            if (tag == 0) {
                $('.quadrantContainner').show();
                $('.quadrant').removeClass('active');
                optionAgelimit.series[0].markLine.data[0].xAxis = avgDevicePrice;
                optionAgelimit.series[0].markLine.data[1].yAxis = avgEstimateTotalCost;
                for (var i = 0; i < xAxisType.length; i++) {
                    series.push([seriesPriceType[i], seriesAgeLimitMeasureType[i], seriesCountType[i], xAxisType[i]]);
                }
                optionAgelimit.series[0].data = series;
                chart.clear();
                chart.setOption(optionAgelimit);
            } else if (tag == 1) {
                $('.quadrantContainner').hide();
                optionB1.xAxis.data = xAxisType;
                optionB1.series[0].data = curBigRepairCountsType;
                optionB1.series[1].data = curMiddleRepairCountsType;
                optionB1.series[2].data = curSmallRepairCountsType;
                optionB1.series[3].data = curFaultCountsType;
                optionB1.series[4].data = curIntactRatioType;
                optionB1.series[5].data = curOnceRepairRateType;
                optionB1.series[6].data = curUpkeepRateType;
                //图表滚动条
                if (xAxisType.length > 12) {
                    optionB1.dataZoom[0].end = 1200 / xAxisType.length;
                } else {
                    optionB1.dataZoom[0].end = 100;
                }
                chart.clear();
                chart.setOption(optionB1);
            }
            $('.option_overyear').removeClass('active');
        }

        // 获取图表数据(设备厂家)
        function queryModelTop5Data(tableId) {
            idsModel = [];
            xAxisModel = [];
            seriesPriceModel = [];   //设备金额
            seriesCountModel = [];   //设备数量
            seriesPriceYoyModel = [];    //金额同比
            seriesCountYoyModel = [];    //数量同比
            seriesHospitalCountModel = [];   //医院数量
            seriesTypeCountModel = [];   //设备类型数量
            seriesDepreciationPriceModel = [];   //折旧金额
            seriesAgeLimitMeasureModel = [];     //年限指数
            seriesDepreciationRatioModel = [];   //折旧率
            seriesDepreciationYoyModel = [];     //折旧同比
            fullNameModel = [];

            /* 平均维修次数 */
            curBigRepairCountsModel = [];
            curMiddleRepairCountsModel = [];
            curSmallRepairCountsModel = [];
            curAvgRepairUsedMinModel = [];
            curAvgResponseMinModel = [];
            curFaultCountsModel = [];
            curToRepairCountsModel = [];
            curIntactRatioModel = [];
            curOnceRepairRateModel = [];
            curUpkeepRateModel = [];

            var url = '';
            if (title == 0) {
                url = '<%=basePath%>/charts/hospital/type-brand/model';
            } else {
                url = '<%=basePath%>/charts/hospital/type-maintain/model';
            }
            $.ajax({
                type: "POST",
                url: url,
                data: {
                  hospitalId: hspId,
                    departmentId: hospitalId ? JSON.stringify(hospitalId) : '',
                    riskId: riskId ? JSON.stringify(riskId) : '',
                    typeId: typeId ? JSON.stringify(typeId) : '',
                    brandId: brandId ? JSON.stringify(brandId) : '',
                    year: year ? JSON.stringify(year) : '',
                    monthId: monthId ? JSON.stringify(monthId) : '',
                    enableYearStart: enableYearStart,
                    enableYearEnd: enableYearEnd,
                    priceStart: priceStart,
                    priceEnd: priceEnd,
                    ageLimitStart: ageLimitStart,
                    ageLimitEnd: ageLimitEnd
                },
                dataType: "json",
                success: function (data) {
                    if (data.ret == 1) {
                        data.data = data.data || {list: []};
                        if (data.data.list) {
                            for (var i = 0; i < data.data.list.length; i++) {
                                idsModel.push(data.data.list[i].id || '');
                                xAxisModel.push(data.data.list[i].name || '');
                                fullNameModel.push(data.data.list[i].fullName || '');
                                if (title == 0) {
                                    seriesPriceModel.push(parseFloat((data.data.list[i].curPrice / CONST) || 0).toFixed(2));
                                    seriesCountModel.push(data.data.list[i].curCounts || 0);
                                    seriesPriceYoyModel.push(parseFloat(data.data.list[i].devicePriceYoy || 0).toFixed(2));
                                    seriesCountYoyModel.push(parseFloat(data.data.list[i].deviceCountsYoy || 0).toFixed(2));
                                    seriesHospitalCountModel.push(data.data.list[i].hospitalCounts || 0);
                                    seriesTypeCountModel.push(data.data.list[i].typeCounts || 0);
                                    seriesDepreciationPriceModel.push(parseFloat((data.data.list[i].curDepreciationPrice / CONST) || 0).toFixed(2));
                                    seriesAgeLimitMeasureModel.push(parseFloat(data.data.list[i].curAgeLimitMeasure || 0).toFixed(2));
                                    seriesDepreciationRatioModel.push(parseFloat(data.data.list[i].depreciationRatio || 0).toFixed(2));
                                    seriesDepreciationYoyModel.push(parseFloat(data.data.list[i].depreciationYoy || 0).toFixed(2));
                                } else if (title == 1) {
                                    curBigRepairCountsModel.push(data.data.list[i].curBigRepairCounts || 0);
                                    curMiddleRepairCountsModel.push(data.data.list[i].curMiddleRepairCounts || 0);
                                    curSmallRepairCountsModel.push(data.data.list[i].curSmallRepairCounts || 0);
                                    curAvgRepairUsedMinModel.push(data.data.list[i].curAvgRepairUsedMin || 0);
                                    curAvgResponseMinModel.push(data.data.list[i].curAvgResponseMin || 0);
                                    curFaultCountsModel.push(data.data.list[i].curFaultCounts || 0);
                                    curToRepairCountsModel.push(data.data.list[i].curToRepairCounts || 0);
                                    curIntactRatioModel.push(parseFloat(data.data.list[i].curIntactRatio || 0).toFixed(2));
                                    curOnceRepairRateModel.push(parseFloat(data.data.list[i].curOnceRepairRate || 0).toFixed(2));
                                    curUpkeepRateModel.push(parseFloat(data.data.list[i].curUpkeepRate || 0).toFixed(2));
                                }
                            }
                            if (title == 0) {
                                sort('desc', seriesPriceModel, idsModel, xAxisModel, seriesCountModel, seriesPriceYoyModel, seriesCountYoyModel, seriesHospitalCountModel, seriesTypeCountModel, seriesDepreciationPriceModel, seriesAgeLimitMeasureModel, seriesDepreciationRatioModel, seriesDepreciationYoyModel, fullNameModel);
                            } else if (title == 1) {
                                sort('desc', curToRepairCountsModel, idsModel, xAxisModel, fullNameModel, curBigRepairCountsModel, curMiddleRepairCountsModel, curSmallRepairCountsModel, curAvgRepairUsedMinModel, curAvgResponseMinModel, curFaultCountsModel, curIntactRatioModel, curOnceRepairRateModel, curUpkeepRateModel);
                            }
                        }
                    } else {
                        flavrShowByTime(data.msg, null, "danger", false);
                    }
                    setUlModel('desc', 0);
                    if ((!$('#modal').is(':hidden')) && ($('#modal').attr('modal') == 'modal')) moremodals();

                    queryStatus.model = true;
                    if (queryStatus.getStatus()) {
                        loading(true);
                        queryStatus.resetStatus();
                    }
                },
                failure: function () {
                    flavrShowByTime('请求失败', null, "danger", false);
                }
            })
        }


        function queryDeviceTop5Data() {
            idsDevice = [];
            xAxisDevice = [];
            modalNameDevice = [];
            departmentDevice = [];
            manufacturerDevice = [];
            snDevice = [];
            assetsNoDevice = [];
            priceDevice = [];
            depreciationPriceDevice = [];
            enableDateDevice = [];
            usedTimeDevice = [];
            ageLimitMeasureDevice = [];
            fullNameDevice = [];

            /* 平均维修次数 */
            curBigRepairCountsDevice = [];
            curMiddleRepairCountsDevice = [];
            curSmallRepairCountsDevice = [];
            curAvgRepairUsedMinDevice = [];
            curAvgResponseMinDevice = [];
            curFaultCountsDevice = [];
            curToRepairCountsDevice = [];
            curIntactRatioDevice = [];
            curOnceRepairRateDevice = [];
            curUpkeepRateDevice = [];

            var url = '';
            if (title == 0) {
                url = '<%=basePath%>/charts/hospital/type-brand/assets';
            } else {
                url = '<%=basePath%>/charts/hospital/type-maintain/assets';
            }
            $.ajax({
                type: "POST",
                url: url,
                data: {
                  hospitalId: hspId,
                    departmentId: hospitalId ? JSON.stringify(hospitalId) : '',
                    riskId: riskId ? JSON.stringify(riskId) : '',
                    typeId: typeId ? JSON.stringify(typeId) : '',
                    brandId: brandId ? JSON.stringify(brandId) : '',
                    year: year ? JSON.stringify(year) : '',
                    monthId: monthId ? JSON.stringify(monthId) : '',
                    enableYearStart: enableYearStart,
                    enableYearEnd: enableYearEnd,
                    priceStart: priceStart,
                    priceEnd: priceEnd,
                    ageLimitStart: ageLimitStart,
                    ageLimitEnd: ageLimitEnd
                },
                dataType: "json",
                success: function (data) {
                    if (data.ret == 1) {
                        data.data = data.data || {list: []};
                        if (data.data.list) {
                            for (var i = 0; i < data.data.list.length; i++) {
                                idsDevice.push(data.data.list[i].id || '');
                                xAxisDevice.push(data.data.list[i].name || '');
                                fullNameDevice.push(data.data.list[i].name || '');
                                if (title == 0) {
                                    modalNameDevice.push(data.data.list[i].modalName || '');
                                    departmentDevice.push(data.data.list[i].department || '');
                                    manufacturerDevice.push(data.data.list[i].manufacturer || '');
                                    snDevice.push(data.data.list[i].sn || '');
                                    assetsNoDevice.push(data.data.list[i].assetsNo || '');
                                    priceDevice.push(parseFloat((data.data.list[i].price / CONST) || 0).toFixed(2));
                                    depreciationPriceDevice.push(parseFloat((data.data.list[i].depreciationPrice / CONST) || 0).toFixed(2));
                                    enableDateDevice.push((data.data.list[i].enableDate || ''));
                                    usedTimeDevice.push(parseFloat(data.data.list[i].usedTime || 0).toFixed(2));
                                    ageLimitMeasureDevice.push(parseFloat(data.data.list[i].ageLimitMeasure || 0).toFixed(2));
                                } else if (title == 1) {
                                    curBigRepairCountsDevice.push(data.data.list[i].curBigRepairCounts || 0);
                                    curMiddleRepairCountsDevice.push(data.data.list[i].curMiddleRepairCounts || 0);
                                    curSmallRepairCountsDevice.push(data.data.list[i].curSmallRepairCounts || 0);
                                    curAvgRepairUsedMinDevice.push(data.data.list[i].curAvgRepairUsedMin || 0);
                                    curAvgResponseMinDevice.push(data.data.list[i].curAvgResponseMin || 0);
                                    curFaultCountsDevice.push(data.data.list[i].curFaultCounts || 0);
                                    curToRepairCountsDevice.push(data.data.list[i].curToRepairCounts || 0);
                                    curIntactRatioDevice.push(parseFloat(data.data.list[i].curIntactRatio || 0).toFixed(2));
                                    curOnceRepairRateDevice.push(parseFloat(data.data.list[i].curOnceRepairRate || 0).toFixed(2));
                                    curUpkeepRateDevice.push(parseFloat(data.data.list[i].curUpkeepRate || 0).toFixed(2));
                                }
                            }
                        }
                        if (title == 0) {
                            sort('desc', priceDevice, idsDevice, xAxisDevice, modalNameDevice, departmentDevice, manufacturerDevice, snDevice, assetsNoDevice, depreciationPriceDevice, enableDateDevice, usedTimeDevice, ageLimitMeasureDevice, fullNameDevice);
                        } else if (title == 1) {
                            sort('desc', curToRepairCountsDevice, idsDevice, xAxisDevice, fullNameDevice, curBigRepairCountsDevice, curMiddleRepairCountsDevice, curSmallRepairCountsDevice, curAvgRepairUsedMinDevice, curAvgResponseMinDevice, curFaultCountsDevice, curIntactRatioDevice, curOnceRepairRateDevice, curUpkeepRateDevice);
                        }
                    } else {
                        flavrShowByTime(data.msg, null, "danger", false);
                    }
                    setUlDevice('desc', 0);
                    if ((!$('#modal').is(':hidden')) && ($('#modal').attr('modal') == 'device')) moredevices();

                    queryStatus.assets = true;
                    if (queryStatus.getStatus()) {
                        loading(true);
                        queryStatus.resetStatus();
                    }
                },
                failure: function (data) {
                    flavrShowByTime(data.msg, null, "danger", false);
                }
            })
        }


        $('#morehospitals').click(morehospitals);

        function morehospitals() {
            loading(function () {
                $('#modal').attr('modal', 'hospital');
                var sb = new StringBuffer();
                $("#tblSort").html('<tbody id="table_data"></tbody>');
                sb.append("<thead><tr><th class='text-center'>#</th>");
                //表头
                sb.append("<th class='text-left'><fmt:message key="share.table.head.yyks"/></th>");

                //表格内容
                if (title == 0) {
                    sb.append("<th class='text-right'><fmt:message key="index.table.sbje(wy)"/></th>"
                        + "<th class='text-right'><fmt:message key="index.table.sbjetb(%)"/></th>"
                        + "<th class='text-right'><fmt:message key="index.table.sbsl(t)"/></th>"
                        + "<th class='text-right'><fmt:message key="index.table.sbsltb(%)"/></th>"
                        + "<th class='text-right'><fmt:message key="performance.table.sblxsl(z)"/></th>"
                        + "<th class='text-right'><fmt:message key="index.table.zjje(wy)"/></th>"
                        + "<th class='text-right'><fmt:message key="index.table.zjl(%)"/></th>"
                        + "<th class='text-right'><fmt:message key="index.table.zjtb(%)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintain.table.nxzs"/></th>"
                        + "</tr></thead>");
                    $("#tblSort").prepend(sb.toString());
                    for (var i = 0; i < xAxis.length; i++) {
                        $("#table_data").append("<tr>"
                            + "<td class='no-cal text-center'>" + (i + 1) + "<span id='detail-" + (i + 1) + "' class='fa fa-plus' style='color: #5395ec;cursor: pointer;margin-left: 5px' onclick='query(\"hospital\", \"" + ids[i] + "\", \"" + (i + 1) + "\")'></span></td>"
                            + "<td class='no-cal text-left spanTitle' onclick='query(\"hospital\",\"" + ids[i] + "\")'>" + xAxis[i] + "</td>"
                            + "<td class='total-1 text-right'>" + parseFloat(seriesPrice[i]).toFixed(2) + "</td>"
                            + "<td class='avg-2 text-right yoy'>" + parseFloat(seriesPriceYoy[i]).toFixed(2) + "</td>"
                            + "<td class='total-3 text-right'>" + seriesCount[i] + "</td>"
                            + "<td class='avg-4 text-right yoy'>" + parseFloat(seriesCountYoy[i]).toFixed(2) + "</td>"
                            + "<td class='total-5 text-right'>" + seriesTypeCount[i] + "</td>"
                            + "<td class='total-6 text-right'>" + parseFloat(seriesDepreciationPrice[i]).toFixed(2) + "</td>"
                            + "<td class='avg-7 text-right'>" + parseFloat(seriesDepreciationRatio[i]).toFixed(2) + "</td>"
                            + "<td class='avg-8 text-right yoy'>" + parseFloat(seriesDepreciationYoy[i]).toFixed(2) + "</td>"
                            + "<td class='avg-9 text-right'>" + parseFloat(seriesAgeLimitMeasure[i]).toFixed(2) + "</td>"
                            + "</tr><tr class='hide detail-tr-" + (i + 1) + "'><td colspan='2' style='display:none;'><td colspan='99' style='padding-right: 0'><div class='detail-div detail-div-" + (i + 1) + "' style='padding-left: 40px'>\
                        <table id='detail-table-" + (i + 1) + "' class='table table-striped table-hover detail-table'>\
                            <tbody></tbody>\
                        </table></div></td></tr>");
                    }
                } else if (title == 1) {
                    sb.append("<th class='text-right'><fmt:message key="maintain.table.dwxsl(c)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintain.table.zwxsl(c)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintain.table.xwxsl(c)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintian.assets.wxcs"/></th>"
                        + "<th class='text-right'><fmt:message key="maintian.assets.pjwxsj(fz)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintian.assets.pjxysj(fz)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintain.table.blsj(c)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintain.table.whl(%)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintainer.table.ycxfl(%)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintain.table.byl(%)"/></th>"
                        + "</tr></thead>");
                    $("#tblSort").prepend(sb.toString());
                    for (var i = 0; i < xAxis.length; i++) {
                        $("#table_data").append("<tr>"
                            + "<td class='no-cal text-center'>" + (i + 1) + "<span id='detail-" + (i + 1) + "' class='fa fa-plus' style='color: #5395ec;cursor: pointer;margin-left: 5px' onclick='query(\"hospital\", \"" + ids[i] + "\", \"" + (i + 1) + "\")'></span></td>"
                            + "<td class='no-cal text-left spanTitle' onclick='query(\"hospital\",\"" + ids[i] + "\")'>" + xAxis[i] + "</td>"
                            + "<td class='total-1 text-right'>" + (curBigRepairCounts[i] || 0) + "</td>"
                            + "<td class='total-2 text-right yoy'>" + (curMiddleRepairCounts[i] || 0) + "</td>"
                            + "<td class='total-3 text-right'>" + (curSmallRepairCounts[i] || 0) + "</td>"
                            + "<td class='total-7 text-right'>" + (curToRepairCounts[i] || 0) + "</td>"
                            + "<td class='avg-4 text-right yoy'>" + (curAvgRepairUsedMin[i] || 0) + "</td>"
                            + "<td class='avg-5 text-right'>" + (curAvgResponseMin[i] || 0) + "</td>"
                            + "<td class='total-6 text-right'>" + (curFaultCounts[i] || 0) + "</td>"
                            + "<td class='avg-8 text-right yoy'>" + parseFloat(curIntactRatio[i] || 0).toFixed(2) + "</td>"
                            + "<td class='avg-9 text-right'>" + parseFloat(curOnceRepairRate[i] || 0).toFixed(2) + "</td>"
                            + "<td class='avg-10 text-right'>" + parseFloat(curUpkeepRate[i] || 0).toFixed(2) + "</td>"
                            + "</tr><tr class='hide detail-tr-" + (i + 1) + "'><td colspan='2' style='display:none;'><td colspan='99' style='padding-right: 0'><div class='detail-div detail-div-" + (i + 1) + "' style='padding-left: 40px'>\
                        <table id='detail-table-" + (i + 1) + "' class='table table-striped table-hover detail-table'>\
                            <tbody></tbody>\
                        </table></div></td></tr>");
                    }
                }
                calTableData('tblSort', true);
                $('#modal').iziModal('setTitle', '<fmt:message key="charts.title.yyksfb"/>');
                $('#modal').iziModal('open', this);
                loading(true);
            });
        }

        $('#moredetail, #moretypes').click(moretypes);

        function moretypes() {
            loading(function () {
                $('#modal').attr('modal', 'type');
                var sb = new StringBuffer();
                $("#tblSort").html('<tbody id="table_data"></tbody>');
                sb.append("<thead><tr><th class='text-center'>#</th>");
                //表头
                sb.append("<th class='text-left'><fmt:message key="share.table.head.sblx"/></th>");

                //表格内容
                if (title == 0) {
                    sb.append("<th class='text-right'><fmt:message key="index.table.sbje(wy)"/></th>"
                        + "<th class='text-right'><fmt:message key="index.table.sbjetb(%)"/></th>"
                        + "<th class='text-right'><fmt:message key="index.table.sbsl(t)"/></th>"
                        + "<th class='text-right'><fmt:message key="index.table.sbjetb(%)"/></th>"
                        + "<th class='text-right'><fmt:message key="share.overview.kssl"/></th>"
                        + "<th class='text-right'><fmt:message key="performance.table.sblxsl(z)"/></th>"
                        + "<th class='text-right'><fmt:message key="share.assets.zjje(wy)"/></th>"
                        + "<th class='text-right'><fmt:message key="index.table.zjl(%)"/></th>"
                        + "<th class='text-right'><fmt:message key="index.table.zjtb(%)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintain.table.nxzs"/></th>"
                        + "</tr></thead>");
                    $("#tblSort").prepend(sb.toString());
                    for (var i = 0; i < xAxisType.length; i++) {
                        $("#table_data").append("<tr>"
                            + "<td class='no-cal text-center'>" + (i + 1) + "</td>"
                            + "<td class='no-cal text-left spanTitle' onclick='query(\"type\",\"" + idsType[i] + "\")'>" + xAxisType[i] + "</td>"
                            + "<td class='total-1 text-right'>" + parseFloat(seriesPriceType[i]).toFixed(2) + "</td>"
                            + "<td class='avg-2 text-right yoy'>" + parseFloat(seriesPriceYoyType[i]).toFixed(2) + "</td>"
                            + "<td class='total-3 text-right'>" + seriesCountType[i] + "</td>"
                            + "<td class='avg-4 text-right yoy'>" + parseFloat(seriesCountYoyType[i]).toFixed(2) + "</td>"
                            + "<td class='total-5 text-right'>" + seriesHospitalCountType[i] + "</td>"
                            + "<td class='total-6 text-right'>" + seriesTypeCountType[i] + "</td>"
                            + "<td class='total-7 text-right'>" + parseFloat(seriesDepreciationPriceType[i]).toFixed(2) + "</td>"
                            + "<td class='avg-8 text-right'>" + parseFloat(seriesDepreciationRatioType[i]).toFixed(2) + "</td>"
                            + "<td class='avg-9 text-right yoy'>" + parseFloat(seriesDepreciationYoyType[i]).toFixed(2) + "</td>"
                            + "<td class='avg-10 text-right'>" + parseFloat(seriesAgeLimitMeasureType[i]).toFixed(2) + "</td>"
                            + "</tr>");
                    }
                } else if (title == 1) {
                    sb.append("<th class='text-right'><fmt:message key="maintain.table.dwxsl(c)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintain.table.zwxsl(c)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintain.table.xwxsl(c)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintian.assets.wxcs"/></th>"
                        + "<th class='text-right'><fmt:message key="maintian.assets.pjwxsj(fz)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintian.assets.pjxysj(fz)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintain.table.blsj(c)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintain.table.whl(%)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintainer.table.ycxfl(%)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintain.table.byl(%)"/></th>"
                        + "</tr></thead>");
                    $("#tblSort").prepend(sb.toString());
                    for (var i = 0; i < xAxisType.length; i++) {
                        $("#table_data").append("<tr>"
                            + "<td class='no-cal text-center'>" + (i + 1) + "<span id='detail-" + (i + 1) + "' class='fa fa-plus' style='color: #5395ec;cursor: pointer;margin-left: 5px' onclick='query(\"type\", \"" + idsType[i] + "\", \"" + (i + 1) + "\")'></span></td>"
                            + "<td class='no-cal text-left spanTitle' onclick='query(\"type\",\"" + idsType[i] + "\")'>" + xAxisType[i] + "</td>"
                            + "<td class='total-1 text-right'>" + (curBigRepairCountsType[i] || 0) + "</td>"
                            + "<td class='total-2 text-right yoy'>" + (curMiddleRepairCountsType[i] || 0) + "</td>"
                            + "<td class='total-3 text-right'>" + (curSmallRepairCountsType[i] || 0) + "</td>"
                            + "<td class='total-7 text-right'>" + (curToRepairCountsType[i] || 0) + "</td>"
                            + "<td class='avg-4 text-right yoy'>" + (curAvgRepairUsedMinType[i] || 0) + "</td>"
                            + "<td class='avg-5 text-right'>" + (curAvgResponseMinType[i] || 0) + "</td>"
                            + "<td class='total-6 text-right'>" + (curFaultCountsType[i] || 0) + "</td>"
                            + "<td class='avg-8 text-right yoy'>" + parseFloat(curIntactRatioType[i] || 0).toFixed(2) + "</td>"
                            + "<td class='avg-9 text-right'>" + parseFloat(curOnceRepairRateType[i] || 0).toFixed(2) + "</td>"
                            + "<td class='avg-10 text-right'>" + parseFloat(curUpkeepRateType[i] || 0).toFixed(2) + "</td>"
                            + "</tr><tr class='hide detail-tr-" + (i + 1) + "'><td colspan='2' style='display:none;'><td colspan='99' style='padding-right: 0'><div class='detail-div detail-div-" + (i + 1) + "' style='padding-left: 40px'>\
                        <table id='detail-table-" + (i + 1) + "' class='table table-striped table-hover detail-table'>\
                            <tbody></tbody>\
                        </table></div></td></tr>");
                    }
                }
                calTableData('tblSort', true);
                $('#modal').iziModal('setTitle', '<fmt:message key="charts.title.sblxfb"/>');
                $('#modal').iziModal('open', this);
                loading(true);
            });
        }

        function query(tag, id, detailId) {
            if (detailId) {
                if (tag == 'hospital') {
                    departmentName = [id];
                    modelName = '';
                } else if (tag == 'model') {
                    departmentName = hospitalId;
                    modelName = id
                }
                queryDeviceData(detailId);
            } else if (tag == 'hospital') {
                location.href = '<%=basePath%>/charts/hospital/type-index/page?departmentId=' + id + '&hospitalId=' + hspId;
            } else if (tag == 'type') {
                location.href = '<%=basePath%>/charts/hospital/model-index/page?typeId=' + id + '&hospitalId=' + hspId;
            } else if (tag == 'device' && deviceRedirect) {
                window.open('<%=basePath%>/charts/overview/assets/page?deviceId=' + id);
            }
        }

        // 通过设备型号查找设备(设备类型)
        function queryDeviceData(detailId) {
            if ($(".detail-tr-" + detailId).hasClass("hide")) {
                $(".detail-tr-" + detailId).removeClass("hide");
                $("#detail-" + detailId).removeClass("fa-plus");
                $("#detail-" + detailId).addClass("fa-minus");
                idsDevice = [];
                xAxisDevice = [];
                seriesDevice = [];
                seriesPriceDevice = [];
                seriesCountDevice = [];
                seriesPriceYoyDevice = [];
                seriesCountYoyDevice = [];
                seriesAgeLimitMeasureDevice = [];
                seriesDepreciationPriceDevice = [];
                $.ajax({
                    type: "POST",
                    url: '<%=basePath%>/charts/hospital/department-brand/device',
                    data: {
                      hospitalId: hspId,
                        riskId: riskId ? JSON.stringify(riskId) : '',
                        departmentId: departmentName ? JSON.stringify(departmentName) : '',
                        typeId: typeId ? JSON.stringify(typeId) : '',
                        modelName: modelName || '',
                        brandId: brandId ? JSON.stringify(brandId) : '',
                        year: year ? JSON.stringify(year) : '',
                        monthId: monthId ? JSON.stringify(monthId) : '',
                        enableYearStart: enableYearStart,
                        enableYearEnd: enableYearEnd,
                        priceStart: priceStart,
                        priceEnd: priceEnd,
                        ageLimitStart: ageLimitStart,
                        ageLimitEnd: ageLimitEnd
                    },
                    dataType: "json",
                    success: function (data) {
                        if (data.ret == 1) {
                            data.data = data.data || {list: []};
                            if (data.data.list.length) {
                                var sb = new StringBuffer();
                                $("#detail-table-" + detailId).html('<tbody id="table_data"></tbody>');
                                sb.append("<thead><tr><th class='text-center'>#</th>");
                                //表头
                                sb.append("<th class='text-left'><fmt:message key="share.table.head.sbmc"/></th>");

                                //表格内容
                                sb.append("<th class='text-left'><fmt:message key="share.table.head.sbxh"/></th>"
                                    + "<th class='text-left'><fmt:message key="share.assets.ssks"/></th>"
                                    + "<th class='text-left'><fmt:message key="share.assets.snbh"/></th>"
                                    + "<th class='text-left'><fmt:message key="share.assets.zcbh"/></th>"
                                    + "<th class='text-left'><fmt:message key="share.table.head.sbcj"/></th>"
                                    + "<th class='text-right'><fmt:message key="share.assets.sbje(wy)"/></th>"
                                    + "<th class='text-right'><fmt:message key="share.assets.zjje(wy)"/></th>"
                                    + "<th class='text-right'><fmt:message key="share.assets.sbqyrq"/></th>"
                                    + "<th class='text-right'><fmt:message key="share.assets.ysysj(n)"/></th>"
                                    + "<th class='text-right'><fmt:message key="maintain.table.nxzs"/></th>"
                                    + "</tr></thead>");
                                $("#detail-table-" + detailId).prepend(sb.toString());
                                for (var i = 0; i < data.data.list.length; i++) {
                                    $("#detail-table-" + detailId + " tbody").append("<tr>"
                                        + "<td class='text-center'>" + (i + 1) + "</td>"
                                        + "<td class='spanTitle' onclick=query(\"device\",\"" + data.data.list[i].id + "\") title='" + (data.data.list[i].name || '') + "'>" + (data.data.list[i].name || '') + "</td>"
                                        + "<td class='text-left'>" + data.data.list[i].modalName + "</td>"
                                        /* + "<td class='text-right'>" + data.data.list[i].hospital + "</td>"*/
                                        + "<td class='text-right'>" + data.data.list[i].department + "</td>"
                                        + "<td class='text-right'>" + data.data.list[i].sn + "</td>"
                                        + "<td class='text-right'>" + data.data.list[i].assetsNo + "</td>"
                                        + "<td class='text-right'>" + (data.data.list[i].manufacturer || '') + "</td>"
                                        + "<td class='text-right'>" + parseFloat((data.data.list[i].price / CONST) || 0).toFixed(2) + "</td>"
                                        + "<td class='text-right'>" + parseFloat((data.data.list[i].depreciationPrice / CONST) || 0).toFixed(2) + "</td>"
                                        + "<td class='text-right'>" + (data.data.list[i].enableDate || '') + "</td>"
                                        + "<td class='text-right'>" + parseFloat(data.data.list[i].usedTime || 0).toFixed(2) + "</td>"
                                        + "<td class='text-right'>" + parseFloat(data.data.list[i].ageLimitMeasure || 0).toFixed(2) + "</td>"
                                        + "</tr>");
                                }

                            } else {
                                $("#detail-table-" + detailId).html('<p><fmt:message key="share.talbe.myxgjl"/></p>');
                            }
                        } else {
                            flavrShowByTime(data.msg, null, "danger", false);
                        }
                    },
                    failure: function () {
                        flavrShowByTime(data.msg, null, "danger", false);
                    }
                })
            } else {
                $(".detail-tr-" + detailId).addClass("hide");
                $("#detail-" + detailId).addClass("fa-plus");
                $("#detail-" + detailId).removeClass("fa-minus");
            }
        }

        $('#moremodel').click(moremodals);

        function moremodals() {
            loading(function () {
                $('#modal').attr('modal', 'modal');
                var sb = new StringBuffer();
                $("#tblSort").html('<tbody id="table_data"></tbody>');
                sb.append("<thead><tr><th class='text-center'>#</th>");
                //表头
                sb.append("<th class='text-left'><fmt:message key="share.assets.sbxh"/></th>");

                // 表格内容
                if (title == 0) {
                    sb.append("<th class='text-right'><fmt:message key="index.table.sbje(wy)"/></th>"
                        + "<th class='text-right'><fmt:message key="index.table.sbjetb(%)"/></th>"
                        + "<th class='text-right'><fmt:message key="index.table.sbsl(t)"/></th>"
                        + "<th class='text-right'><fmt:message key="index.table.sbjetb(%)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintainer.table.kssl(g)"/></th>"
                        + "<th class='text-right'><fmt:message key="performance.table.sblxsl(z)"/></th>"
                        + "<th class='text-right'><fmt:message key="share.assets.zjje(wy)"/></th>"
                        + "<th class='text-right'><fmt:message key="index.table.zjl(%)"/></th>"
                        + "<th class='text-right'><fmt:message key="index.table.zjtb(%)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintain.table.nxzs"/></th>"
                        + "</tr></thead>");
                    $("#tblSort").prepend(sb.toString());
                    for (var i = 0; i < xAxisModel.length; i++) {
                        $("#table_data").append("<tr>"
                            + "<td class='no-cal text-center'>" + (i + 1) + "<span id='detail-" + (i + 1) + "' class='fa fa-plus' style='color: #5395ec;cursor: pointer;margin-left: 5px' onclick='query(\"model\", \"" + idsModel[i] + "\", \"" + (i + 1) + "\")'></span></td>"
                            + "<td class='no-cal text-left spanTitle' onclick='query(\"model\",\"" + idsModel[i] + "\")'>" + xAxisModel[i] + "</td>"
                            + "<td class='total-1 text-right'>" + parseFloat(seriesPriceModel[i]).toFixed(2) + "</td>"
                            + "<td class='avg-2 text-right yoy'>" + parseFloat(seriesPriceYoyModel[i]).toFixed(2) + "</td>"
                            + "<td class='total-3 text-right'>" + seriesCountModel[i] + "</td>"
                            + "<td class='avg-4 text-right yoy'>" + parseFloat(seriesCountYoyModel[i]).toFixed(2) + "</td>"
                            + "<td class='total-5 text-right'>" + seriesHospitalCountModel[i] + "</td>"
                            + "<td class='total-6 text-right'>" + seriesTypeCountModel[i] + "</td>"
                            + "<td class='total-7 text-right'>" + parseFloat(seriesDepreciationPriceModel[i]).toFixed(2) + "</td>"
                            + "<td class='avg-8 text-right'>" + parseFloat(seriesDepreciationRatioModel[i]).toFixed(2) + "</td>"
                            + "<td class='avg-9 text-right yoy'>" + parseFloat(seriesDepreciationYoyModel[i]).toFixed(2) + "</td>"
                            + "<td class='avg-10 text-right'>" + parseFloat(seriesAgeLimitMeasureModel[i]).toFixed(2) + "</td>"
                            + "</tr><tr class='hide detail-tr-" + (i + 1) + "'><td colspan='2' style='display:none;'><td colspan='99' style='padding-right: 0'><div class='detail-div detail-div-" + (i + 1) + "' style='padding-left: 40px'>\
                        <table id='detail-table-" + (i + 1) + "' class='table table-striped table-hover detail-table'>\
                            <tbody></tbody>\
                        </table></div></td></tr>");
                    }
                } else if (title == 1) {
                    sb.append("<th class='text-right'><fmt:message key="maintain.table.dwxsl(c)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintain.table.zwxsl(c)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintain.table.xwxsl(c)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintian.assets.wxcs"/></th>"
                        + "<th class='text-right'><fmt:message key="maintian.assets.pjwxsj(fz)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintian.assets.pjxysj(fz)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintain.table.blsj(c)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintain.table.whl(%)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintainer.table.ycxfl(%)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintain.table.byl(%)"/></th>"
                        + "</tr></thead>");
                    $("#tblSort").prepend(sb.toString());
                    for (var i = 0; i < xAxisModel.length; i++) {
                        $("#table_data").append("<tr>"
                            + "<td class='no-cal text-center'>" + (i + 1) + "<span id='detail-" + (i + 1) + "' class='fa fa-plus' style='color: #5395ec;cursor: pointer;margin-left: 5px' onclick='query(\"model\", \"" + idsModel[i] + "\", \"" + (i + 1) + "\")'></span></td>"
                            + "<td class='no-cal text-left spanTitle' onclick='query(\"model\",\"" + idsModel[i] + "\")'>" + xAxisModel[i] + "</td>"
                            + "<td class='total-1 text-right'>" + (curBigRepairCountsModel[i] || 0) + "</td>"
                            + "<td class='total-2 text-right yoy'>" + (curMiddleRepairCountsModel[i] || 0) + "</td>"
                            + "<td class='total-3 text-right'>" + (curSmallRepairCountsModel[i] || 0) + "</td>"
                            + "<td class='total-7 text-right'>" + (curToRepairCountsModel[i] || 0) + "</td>"
                            + "<td class='avg-4 text-right yoy'>" + (curAvgRepairUsedMinModel[i] || 0) + "</td>"
                            + "<td class='avg-5 text-right'>" + (curAvgResponseMinModel[i] || 0) + "</td>"
                            + "<td class='total-6 text-right'>" + (curFaultCountsModel[i] || 0) + "</td>"
                            + "<td class='avg-8 text-right yoy'>" + parseFloat(curIntactRatioModel[i] || 0).toFixed(2) + "</td>"
                            + "<td class='avg-9 text-right'>" + parseFloat(curOnceRepairRateModel[i] || 0).toFixed(2) + "</td>"
                            + "<td class='avg-10 text-right'>" + parseFloat(curUpkeepRateModel[i] || 0).toFixed(2) + "</td>"
                            + "</tr><tr class='hide detail-tr-" + (i + 1) + "'><td colspan='2' style='display:none;'><td colspan='99' style='padding-right: 0'><div class='detail-div detail-div-" + (i + 1) + "' style='padding-left: 40px'>\
                        <table id='detail-table-" + (i + 1) + "' class='table table-striped table-hover detail-table'>\
                            <tbody></tbody>\
                        </table></div></td></tr>");
                    }
                }
                calTableData('tblSort', true);
                $('#modal').iziModal('setTitle', '<fmt:message key="share.table.title.sbcjfbxq"/>');
                $('#modal').iziModal('open', this);
                loading(true);
            });
        }

        $('#moredevices').click(moredevices);

        function moredevices() {
            loading(function () {
                $('#modal').attr('modal', 'device');
                var sb = new StringBuffer();
                $("#tblSort").html('<tbody id="table_data"></tbody>');
                sb.append("<thead><tr><th class='text-center'>#</th>");
                //表头
                sb.append("<th class='text-left'><fmt:message key="share.table.head.sbmc"/></th>");

                //表格内容
                if (title == 0) {
                    sb.append("<th class='text-left'><fmt:message key="share.table.head.sbxh"/></th>"
                        + "<th class='text-left'><fmt:message key="share.assets.ssks"/></th>"
                        + "<th class='text-left'><fmt:message key="share.table.head.sbcj"/></th>"
                        + "<th class='text-left'><fmt:message key="share.assets.snbh"/></th>"
                        + "<th class='text-left'><fmt:message key="share.assets.zcbh"/></th>"
                        + "<th class='text-right'><fmt:message key="share.assets.sbqyrq"/></th>"
                        + "<th class='text-right'><fmt:message key="performance.table.sbje(wy)"/></th>"
                        + "<th class='text-right'><fmt:message key="share.assets.zjje(wy)"/></th>"
                        + "<th class='text-right'><fmt:message key="share.assets.ysysj(n)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintain.table.nxzs"/></th>"
                        + "</tr></thead>");
                    $("#tblSort").prepend(sb.toString());
                    for (var i = 0; i < xAxisDevice.length; i++) {
                        $("#table_data").append("<tr>"
                            + "<td class='no-cal text-center'>" + (i + 1) + "</td>"
                            + "<td class='no-cal spanTitle' onclick='query(\"device\",\"" + idsDevice[i] + "\")' title='" + xAxisDevice[i] + "'>" + xAxisDevice[i] + "</td>"
                            + "<td class='no-cal text-left'>" + modalNameDevice[i] + "</td>"
                            + "<td class='no-cal text-left'>" + departmentDevice[i] + "</td>"
                            + "<td class='no-cal' title='" + manufacturerDevice[i] + "'>" + manufacturerDevice[i] + "</td>"
                            + "<td class='no-cal text-left'>" + snDevice[i] + "</td>"
                            + "<td class='no-cal text-left'>" + assetsNoDevice[i] + "</td>"
                            + "<td class='no-cal text-right'>" + enableDateDevice[i] + "</td>"
                            + "<td class='total-1 text-right'>" + priceDevice[i] + "</td>"
                            + "<td class='total-2 text-right'>" + depreciationPriceDevice[i] + "</td>"
                            + "<td class='total-3 text-right'>" + usedTimeDevice[i] + "</td>"
                            + "<td class='avg-4 text-right'>" + ageLimitMeasureDevice[i] + "</td>"
                            + "</tr>");
                    }
                } else if (title == 1) {
                    sb.append("<th class='text-right'><fmt:message key="maintain.table.dwxsl(c)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintain.table.zwxsl(c)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintain.table.xwxsl(c)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintian.assets.wxcs"/></th>"
                        + "<th class='text-right'><fmt:message key="maintian.assets.pjwxsj(fz)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintian.assets.pjxysj(fz)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintain.table.blsj(c)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintain.table.whl(%)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintainer.table.ycxfl(%)"/></th>"
                        + "<th class='text-right'><fmt:message key="maintain.table.byl(%)"/></th>"
                        + "</tr></thead>");
                    $("#tblSort").prepend(sb.toString());
                    for (var i = 0; i < xAxisDevice.length; i++) {
                        $("#table_data").append("<tr>"
                            + "<td class='no-cal text-center'>" + (i + 1) + "</td>"
                            + "<td class='no-cal text-left'>" + xAxisDevice[i] + "</td>"
                            + "<td class='total-1 text-right'>" + (curBigRepairCountsDevice[i] || 0) + "</td>"
                            + "<td class='total-2 text-right'>" + (curMiddleRepairCountsDevice[i] || 0) + "</td>"
                            + "<td class='total-3 text-right'>" + (curSmallRepairCountsDevice[i] || 0) + "</td>"
                            + "<td class='total-7 text-right'>" + (curToRepairCountsDevice[i] || 0) + "</td>"
                            + "<td class='avg-4 text-right'>" + (curAvgRepairUsedMinDevice[i] || 0) + "</td>"
                            + "<td class='avg-5 text-right'>" + (curAvgResponseMinDevice[i] || 0) + "</td>"
                            + "<td class='total-6 text-right'>" + (curFaultCountsDevice[i] || 0) + "</td>"
                            + "<td class='avg-8 text-right'>" + parseFloat(curIntactRatioDevice[i] || 0).toFixed(2) + "</td>"
                            + "<td class='avg-9 text-right'>" + parseFloat(curOnceRepairRateDevice[i] || 0).toFixed(2) + "</td>"
                            + "<td class='avg-10 text-right'>" + parseFloat(curUpkeepRateDevice[i] || 0).toFixed(2) + "</td>"
                            + "</tr>");
                    }
                }
                calTableData('tblSort');
                $('#modal').iziModal('setTitle', '<fmt:message key="share.table.title.sbfbxq"/>');
                $('#modal').iziModal('open', this);
                loading(true);
            });
        }

        // 历年数据点击事件
        $('#overyear').click(function () {
            if ($(this).hasClass('active')) {
                $('#moredetail').html('<fmt:message key="charts.title.sblxfb"/>').off().on('click', moretypes);
                $(this).html('<fmt:message key="charts.button.lnsj"/>').removeClass('active');
                showYearTop5();
                chart.clear();
                chart.setOption(optionAgelimit);
                $('.quadrantContainner').show();
                $('.quadrant').removeClass('active');
                $('#tag').next().show();
            } else {
                $(this).html('<fmt:message key="charts.button.qbxs"/>').addClass('active');
                showYearTop5(true);
                loading(function () {
                    $('.quadrantContainner').hide();
                    $('#tag').next().hide();
                    $('#moredetail').html('<fmt:message key="charts.button.lnsj"/>').off().on('click', moreyear);
                    xAxisB = [];
                    idsB = [];
                    seriesCurPrice = [];
                    seriesCurCount = [];
                    seriesCurAgeLimitMeasure = [];
                    seriesCurDepreciationPrice = [];
                    seriesDepreciationRatio = [];
                    $("#ul_year").html('');
                    $.ajax({
                        url: '<%=basePath%>/charts/hospital/type-brand/year-trend',
                        data: {
                            hospitalId: hspId,
                            departmentId: hospitalId ? JSON.stringify(hospitalId) : '',
                            riskId: riskId ? JSON.stringify(riskId) : '',
                            typeId: typeId ? JSON.stringify(typeId) : '',
                            brandId: brandId ? JSON.stringify(brandId) : '',
                            year: year ? JSON.stringify(year) : '',
                            monthId: monthId ? JSON.stringify(monthId) : '',
                            enableYearStart: enableYearStart,
                            enableYearEnd: enableYearEnd,
                            priceStart: priceStart,
                            priceEnd: priceEnd,
                            ageLimitStart: ageLimitStart,
                            ageLimitEnd: ageLimitEnd
                        },
                        type: 'post',
                        success: function (data) {
                            if (data.ret == 1) {
                                data.data = data.data || {list: []};
                                for (var i = 0; i < data.data.list.length; i++) {
                                    xAxisB.push(data.data.list[i].name || '');
                                    idsB.push(data.data.list[i].id || '');
                                    seriesCurPrice.push(parseFloat((data.data.list[i].curPrice / CONST) || 0).toFixed(2));
                                    seriesCurCount.push(data.data.list[i].curCounts || 0);
                                    seriesCurAgeLimitMeasure.push(parseFloat(data.data.list[i].curAgeLimitMeasure || 0).toFixed(2));
                                    seriesCurDepreciationPrice.push(parseFloat((data.data.list[i].curDepreciationPrice / CONST) || 0).toFixed(2));
                                    seriesDepreciationRatio.push(parseFloat(data.data.list[i].depreciationRatio || 0).toFixed(2));

                                    $("#ul_year").append(
                                        '<li><a><span class="fl data_span_f">' + data.data.list[i].name + '</span><em class="fl data_span_s">'
                                        + parseFloat(data.data.list[i].curAgeLimitMeasure || 0).toFixed(2) + '</em><em class="fr">'
                                        + parseFloat((data.data.list[i].curPrice / CONST) || 0).toFixed(2) + '</em></a></li>');
                                }
                                optionB.xAxis.data = xAxisB;
                                optionB.series[0].data = seriesCurPrice;
                                optionB.series[1].data = seriesCurCount;
                                chart.clear();
                                chart.setOption(optionB);
                            } else {
                                flavrShowByTime(data.msg, null, "danger", false);
                            }
                            loading(true);
                        },
                        failure: function (data) {
                            flavrShowByTime(data.msg, null, "danger", false);
                        }
                    });
                });
            }
        });

        function moreyear() {
            loading(function () {
                var sb = new StringBuffer();
                $("#tblSort").html('<tbody id="table_data"></tbody>');
                sb.append("<thead><tr><th class='text-center'>#</th>");
                //表头
                sb.append("<th class='text-left'><fmt:message key="share.table.head.nf"/></th>");

                //表格内容
                sb.append("<th class='text-right'><fmt:message key="index.table.sbje(wy)"/></th>"
                    + "<th class='text-right'><fmt:message key="index.table.sbsl(t)"/></th>"
                    + "<th class='text-right'><fmt:message key="index.table.zjje(wy)"/></th>"
                    + "<th class='text-right'><fmt:message key="index.table.zjl(%)"/></th>"
                    + "<th class='text-right'><fmt:message key="index.table.nxzs"/></th>"
                    + "</tr></thead>");
                $("#tblSort").prepend(sb.toString());
                for (var i = 0; i < xAxisB.length; i++) {
                    $("#table_data").append("<tr>"
                        + "<td class='no-cal text-center'>" + (i + 1) + "</td>"
                        + "<td class='no-cal text-left'>" + xAxisB[i] + "</td>"
                        + "<td class='total-1 text-right'>" + parseFloat(seriesCurPrice[i]).toFixed(2) + "</td>"
                        + "<td class='total-2 text-right'>" + seriesCurCount[i] + "</td>"
                        + "<td class='total-3 text-right'>" + parseFloat(seriesCurDepreciationPrice[i]).toFixed(2) + "</td>"
                        + "<td class='avg-5 text-right'>" + parseFloat(seriesDepreciationRatio[i]).toFixed(2) + "</td>"
                        + "<td class='average-1 text-right'>" + parseFloat(seriesCurAgeLimitMeasure[i]).toFixed(2) + "</td>"
                        + "</tr>");
                }
                calTableData("tblSort", true);
                $('#modal').iziModal('setTitle', '<fmt:message key="charts.button.lnsj"/>');
                $('#modal').iziModal('open', this);
                loading(true);
            });
        }

        // 柱状 + 折线  历年数据Option
        // 柱状 + 折线
        var optionB = {
            color: ['#2089ff', '#6c63ff', '#12a0df', '#fb8a22', '#fef534'],
            backgroundColor: '#373945',
            tooltip: {
                trigger: 'axis',
                axisPointer: { // 坐标轴指示器，坐标轴触发有效
                    type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
                },
                textStyle: {
                    fontSize: 0.28 * rem
                },
                formatter: function (a) {
                    if (a.componentType == "markLine") {
                        return a.name + ':' + a.value;
                    } else {
                        var index = a[0].dataIndex;
                        return xAxisB[index] + '<br/>'
                            + '<fmt:message key="share.overview.sbje"/>：' + seriesCurPrice[index] + '<fmt:message key="share.unit.wanyuan"/><br/>'
                            + '<fmt:message key="share.overview.sbsl"/>：' + seriesCurCount[index] + '<fmt:message key="share.unit.tai"/>';
                    }
                }
            },
            legend: {
                x: "right",
                textStyle: {
                    color: '#AAA',
                    fontSize: 0.28 * rem
                },
                data: ['<fmt:message key="share.overview.sbje"/>', '<fmt:message key="share.overview.sbsl"/>']
            },
            grid: {
                top: 1.2 * rem,
                left: 0.4 * rem,
                right: 0.4 * rem,
                bottom: 0.8 * rem,
                containLabel: true
            },
            xAxis: {
                type: 'category',
                data: [],
                axisLabel: {
                    rotate: 30,
                    fontSize: 0.28 * rem
                }
            },
            yAxis: [{
                name: '<fmt:message key="share.unit.wanyuan"/>',
                type: 'value',
                nameTextStyle: {
                    color: '#AAA',
                    fontSize: 0.28 * rem
                },
                splitLine: {
                    lineStyle: {
                        type: 'dashed'
                    }
                },
                axisLabel: {
                    fontSize: 0.28 * rem
                }
            }, {
                name: '<fmt:message key="share.unit.tai"/>',
                type: 'value',
                nameTextStyle: {
                    color: '#AAA',
                    fontSize: 0.28 * rem
                },
                splitLine: {
                    show: false
                },
                axisLabel: {
                    fontSize: 0.28 * rem
                }
            }],
            series: [{
                name: '<fmt:message key="share.overview.sbje"/>',
                type: 'bar',
                barMaxWidth: barMaxWidth,
                barGap: '0%',
                data: []
            }, {
                name: '<fmt:message key="share.overview.sbsl"/>',
                type: 'bar',
                barMaxWidth: barMaxWidth,
                yAxisIndex: 1,
                data: []
            }]
        };

        // 柱状 + 折线
        var optionB1 = {
            color: ['#2089ff', '#6c63ff', '#12a0df', '#fb8a22', '#fef534'],
            backgroundColor: '#373945',
            tooltip: {
                trigger: 'axis',
                axisPointer: { // 坐标轴指示器，坐标轴触发有效
                    type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
                },
                textStyle: {
                    fontSize: 0.28 * rem
                },
                formatter: function (a) {
                    if (a.componentType == "markLine") {
                        return a.name + ':' + a.value;
                    } else {
                        var index = a[0].dataIndex;
                        return xAxisType[index] + '<br/>'
                            + '<fmt:message key="maintain.charts.dwxsl"/>：' + curBigRepairCountsType[index] + '<fmt:message key="share.unit.ci"/><br/>'
                            + '<fmt:message key="maintain.charts.zwxsl"/>：' + curMiddleRepairCountsType[index] + '<fmt:message key="share.unit.ci"/><br/>'
                            + '<fmt:message key="maintain.charts.xwxsl"/>：' + curSmallRepairCountsType[index] + '<fmt:message key="share.unit.ci"/><br/>'
                            + '<fmt:message key="maintain.charts.blsj"/>：' + curFaultCountsType[index] + '<fmt:message key="share.unit.ci"/><br/>'
                            + '<fmt:message key="maintain.charts.whl"/>：' + curIntactRatioType[index] + '%<br/>'
                            + '<fmt:message key="brand.overview.ycxfl"/>：' + curOnceRepairRateType[index] + '%<br/>'
                            + '<fmt:message key="maintain.charts.byl"/>：' + curUpkeepRateType[index] + '%';
                    }
                }
            },
            legend: {
                x: "right",
                left: 7 * rem,
                textStyle: {
                    color: '#AAA',
                    fontSize: 0.28 * rem
                },
                data: ['<fmt:message key="maintain.charts.dwxsl"/>', '<fmt:message key="maintain.charts.zwxsl"/>', '<fmt:message key="maintain.charts.xwxsl"/>', '<fmt:message key="maintain.charts.blsj"/>', '<fmt:message key="maintain.charts.whl"/>', '<fmt:message key="brand.overview.ycxfl"/>', '<fmt:message key="maintain.charts.byl"/>']
            },
            dataZoom: [{
                type: 'inside',
                xAxisIndex: [0],
                start: 0,
                end: 100
            }],
            grid: {
                top: 1.2 * rem,
                left: 0.4 * rem,
                right: 0.4 * rem,
                bottom: 0.8 * rem,
                containLabel: true
            },
            xAxis: {
                type: 'category',
                data: [],
                axisLabel: {
                    rotate: 30,
                    fontSize: 0.28 * rem
                }
            },
            yAxis: [{
                name: '<fmt:message key="share.unit.ci"/>',
                type: 'value',
                nameTextStyle: {
                    color: '#AAA',
                    fontSize: 0.28 * rem
                },
                splitLine: {
                    lineStyle: {
                        type: 'dashed'
                    }
                },
                axisLabel: {
                    fontSize: 0.28 * rem
                }
            }, {
                name: '%',
                type: 'value',
                nameTextStyle: {
                    fontSize: 0.28 * rem
                },
                splitLine: {
                    show: false,
                    lineStyle: {
                        type: 'dashed'
                    }
                },
                axisLabel: {
                    fontSize: 0.28 * rem
                }
            }],
            series: [{
                name: '<fmt:message key="maintain.charts.dwxsl"/>',
                type: 'bar',
                barMaxWidth: barMaxWidth,
                barGap: '0%',
                stack: 'one',
                data: []
            }, {
                name: '<fmt:message key="maintain.charts.zwxsl"/>',
                type: 'bar',
                barMaxWidth: barMaxWidth,
                stack: 'one',
                data: []
            }, {
                name: '<fmt:message key="maintain.charts.xwxsl"/>',
                type: 'bar',
                barMaxWidth: barMaxWidth,
                stack: 'one',
                data: []
            }, {
                name: '<fmt:message key="maintain.charts.blsj"/>',
                type: 'bar',
                barMaxWidth: barMaxWidth,
                data: []
            }, {
                name: '<fmt:message key="maintain.charts.whl"/>',
                type: 'line',
                yAxisIndex: 1,
                data: []
            }, {
                name: '<fmt:message key="brand.overview.ycxfl"/>',
                type: 'line',
                yAxisIndex: 1,
                data: []
            }, {
                name: '<fmt:message key="maintain.charts.byl"/>',
                type: 'line',
                yAxisIndex: 1,
                data: []
            }]
        };

        //设备年限气泡图
        var optionAgelimit = {
            color: ['#31860f'],
            backgroundColor: '#373945',
            tooltip: {
                trigger: 'item',
                textStyle: {
                    fontSize: 0.28 * rem
                },
                formatter: function (a) {
                    if (a.componentType == "markLine") {
                        return a.name + ':' + a.value;
                    } else {
                        var index = a.dataIndex;
                        return xAxisType[index] + '<br/>'
                            + '<fmt:message key="index.overview.yyks.sbje"/>：' + seriesPriceType[index] + '<fmt:message key="share.unit.wanyuan"/><br/>'
                            + '<fmt:message key="index.overview.yyks.sbsl"/>：' + seriesCountType[index] + '<fmt:message key="share.unit.tai"/><br/>'
                            + '<fmt:message key="index.overview.yyks.zjje"/>：' + seriesDepreciationPriceType[index] + '<fmt:message key="share.unit.wanyuan"/><br/>'
                            + '<fmt:message key="share.assets.nxzs"/>：' + seriesAgeLimitMeasureType[index] + '<br/>'
                            + '<fmt:message key="index.overview.sblx.sblxsl"/>：' + seriesTypeCountType[index];
                    }
                }
            },
            dataZoom: [{
                type: 'inside',
                xAxisIndex: [0],
                start: 0,
                end: 100
            },
                {
                    type: 'inside',
                    yAxisIndex: [0],
                    start: 0,
                    end: 100
                }
            ],
            grid: {
                top: 1.2 * rem,
                left: 0.4 * rem,
                right: 2.4 * rem,
                bottom: 0.8 * rem,
                containLabel: true
            },
            xAxis: {
                name: '<fmt:message key="charts.axis.sbje-wy"/>',
                type: 'value',
                nameTextStyle: {
                    color: '#AAA',
                    fontSize: 0.28 * rem
                },
                axisLabel: {
                    show: true,
                    fontSize: 0.28 * rem,
                    textStyle: {
                        color: '#fff'
                    }
                },
                splitLine: {
                    show: false,
                    lineStyle: {
                        color: '#f00',
                        type: 'dashed'
                    }
                },
                axisLine: {
                    lineStyle: {
                        color: '#fff'
                    }
                },
                axisTick: {
                    lineStyle: {
                        color: '#fff'
                    }
                }
            },
            yAxis: [{
                name: '<fmt:message key="share.assets.nxzs"/>',
                type: 'value',
                nameTextStyle: {
                    color: '#AAA',
                    fontSize: 0.28 * rem
                },
                axisLabel: {
                    show: true,
                    fontSize: 0.28 * rem,
                    textStyle: {
                        color: '#fff'
                    }
                },
                splitLine: {
                    show: false,
                    lineStyle: {
                        color: '#f00',
                        type: 'dashed'
                    }
                },
                axisLine: {
                    lineStyle: {
                        color: '#fff'
                    }
                },
                axisTick: {
                    lineStyle: {
                        color: '#fff'
                    }
                }
            }],
            series: [{
                type: 'scatter',
                data: [],
                symbolSize: function (data) {
                    var max = seriesCountType.max(),
                        min = seriesCountType.min(),
                        range = max - min;
                    if (data[2] === 0) return 0;
                    if (range == 0) return 35;
                    return data[2] === 0 ? 0 : (30 * (data[2] - min) / range + 20);
                },
                markLine: {
                    lineStyle: {
                        normal: {
                            color: '#f00',
                            type: 'dashed',
                            opacity: 0.4
                        }
                    },
                    data: [
                        {
                            type: 'average',
                            name: '<fmt:message key="charts.avg.sbjepjz(wy)"/>',
                            valueIndex: 0,
                            xAxis: null
                        },
                        {type: 'average', name: '<fmt:message key="charts.avg.nxzsbzx"/>', valueIndex: 1, yAxis: null}
                    ]
                }
            }]
        };
    </script>
    </body>
</fmt:bundle>
</html>
